…using while loops is creating loops that never end. This happens because the condition never becomes false. If it happens to you, your program will crash. Example:let hungry = true; while (hungry) { console.log("eat"); }TaskHow many times will the body of this loop be executed:let i = 0; while (i…
…using the User model class which was discussed in the earlier section. On the other hand, the validateCredentials method is used to validate a user against the given set of credentials. And that was the implementation of our custom authentication provider. In the next section, we'll go ahead and create…
…using Angular. What Is an Angular Component? In Angular, we work with directives. There are three types of directives: structural, attributes, and components. In the next few sections, we will dig into everything about components. Components in Angular are the elements which we design and build to render UI items.…
…using npm install. After the dependencies have been installed, start the application by typing the following command: ng serve You should have the application running on https://localhost:4200/. The overall folder structure of our project will be as follows. src --app ----components ------employee.component.css ------employee.component.html ------employee.component.ts ----services ------employee.service.spec.ts ------employee.service.ts ------employeeDetails.service.ts --app.routing.module.ts --app.component.css…
…using the base tag. We are going to use the app folder as the root of the application using the "/" path. Making this change tells Angular the starting location for all the different routes in your application. <!doctype html> <html> <head> <base href="/"> <title>Angular Routing</title> </head> . . .…
…using the base tag. We are going to use the app folder as the root of the application using the "/" path. Making this change tells Angular the starting location for all the different routes in your application. <!doctype html> <html> <head> <base href="/"> <title>Angular Routing</title> </head> . . .…
…using the right techniques for building a single-page application that creates HTTP requests and handles HTTP responses in a maintainable and scalable manner. The @angular/common/http package comes with a client, interceptor, and many more features for your Angular application. Single-page applications often need to scale, and the framework needs to…
…using tokens. Let's dive in.Cookies vs. TokensLet's talk a little about cookies and tokens, to understand how they work and the differences between them.Cookie-based authentication keeps an authentication record or session both on the server and the client side. In other words, it is stateful. The server keeps track of…
…using the latest version of Laravel, version 5.5, to create a RESTful back-end API. The front end will comprise of components written in React. We will be building a resourceful product listing application. The first part of the tutorial will focus more on the Laravel concepts and the back end.…
…using a v-model, which is a directive that allows us to perform two-way data bindings on form inputs. It automatically updates the DOM based on the input entered. The data binding is also possible for select options and checkboxes, as you can see above.A directive is a special token in…