mat-form-field must contain a MatFormFieldControl

Import MatInputModule in your module.ts file and it will solve the problem. The statement after it is the old answer. Unfortunately content projection into mat-form-field is not supported yet. Please track the following github issue to get the latest news about it. By now the only solution for you is either place your content directly into mat-form-field component or implement a MatFormFieldControl class … Read more

What is the difference between Promises and Observables?

Promise A Promise handles a single event when an async operation completes or fails. Note: There are Promise libraries out there that support cancellation, but ES6 Promise doesn’t so far. Observable An Observable is like a Stream (in many languages) and allows to pass zero or more events where the callback is called for each event. Often Observable is preferred over Promise because it provides the features of Promise and more. With Observable it doesn’t … Read more

BehaviorSubject vs Observable?

BehaviorSubject is a type of subject, a subject is a special type of observable so you can subscribe to messages like any other observable. The unique features of BehaviorSubject are: It needs an initial value as it must always return a value on subscription even if it hasn’t received a next() Upon subscription, it returns the last … Read more

What is .subscribe in Angular?

I’m going through angular-tour-of-heroes app, and I encountered .subscribe method in routing. Can someone explain what’s going on here? Link for the app: https://embed.plnkr.co/?show=preview Inside hero-detail.component.ts file,

Angular: Get current index in ngFor

As per OP’s comment on question : So, I am trying to get the index of the ngFor in order to do a comparison to array of data before triggering another function. For example, the test() function will be triggered when I click a button, then it will check the current index, and do something … Read more

What is pipe for in RxJS?

The “pipeable” (former “lettable”) operators is the current and recommended way of using operators since RxJS 5.5. I strongly recommend you to read the official documentation on pipeable operators The main difference is that it’s easier to make custom operators and that it’s better treeshakable while not altering some global Observable object that could possible make collisions if two different … Read more

How to upgrade Angular CLI to the latest version

After reading some issues reported on the GitHub repository, I found the solution. In order to update the angular-cli package installed globally in your system, you need to run: Depending on your system, you may need to prefix the above commands with sudo. Also, most likely you want to also update your local project version, because … Read more

ngFor with index as value in attribute

I would use this syntax to set the index value into an attribute of the HTML element: Angular >= 2 You have to use let to declare the value rather than #. Angular = 1 Here is the updated plunkr: http://plnkr.co/edit/LiCeyKGUapS5JKkRWnUJ?p=preview.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)