How to use jQuery with Angular?

Using jQuery from Angular2 is a breeze compared to ng1. If you are using TypeScript you could first reference jQuery typescript definition. TypescriptDefinitions are not required since you could just use any as the type for $ or jQuery In your angular component you should reference a DOM element from the template using @ViewChild() After the view has been initialized you can … Read more

Why do i need `typings.json` file in an Angular 2 project?

So, I’ve found this: Any JavaScript libraries, such as jQuery, the Jasmine testing library, and Angular, extend the JavaScript environment with features and syntax that the TypeScript compiler doesn’t recognize natively. When the compiler doesn’t recognize something, it throws an error. So, If we wrote a library which may use by other persons in their … Read more

Angular 5: “No provider for ControlContainer”

The ControlContainer is a abstract class which is extended by the AbstractFormGroupDirective inside the ReactiveFormsModule. The error is thrown if you’re using the ReactiveFormsModule and a <form>-element without a FormGroup bound to it via [formGroup]=”myForm”. To fix this error you have to create a FormGroup and bind it to your form: Also make sure you … Read more

How to enable production mode?

You enable it by importing and executing the function (before calling bootstrap): But this error is indicator that something is wrong with your bindings, so you shouldn’t just dismiss it, but try to figure out why it’s happening.

Angular error: Please add a @NgModule annotation

You’re trying to “import” a component in SomeModule. You import modules and declare components, which is exactly what the error message tells you — you tried importing a directive SomeComponent. Unexpected directive ‘SomeComponent’ imported by the module ‘SomeModule’. Move the SomeComponent from imports to declarations.