Skip to main content

Posts

Showing posts with the label Angular 2 @Inject vs @Injectable

Angular 2 Inject - Why @Inject()?

Angular 2 @Inject() is a special technique for letting Angular know that a parameter must be injected. Stayed Informed-  @Injectable() vs. @Inject()?  Example as, import { Inject} from '@angular/core' ; import { Http, Response } from '@angular/http' ; class UserService { users: Array < any > ; constructor ( @ Inject(Http) _http: Http ) { } } Angular2 - Related Concepts When use @Inject()? When Use @Injectable ()? @Injectable() vs. @Inject() ? How to use Dependency Injection (DI) correctly in Angular 2? Dependency Injection (DI) in Angular 2? I hope you are enjoying with this post! Please share with you friends. Thank you!!

How would you Optimize the Angular 2 Application for Better Performance?

The optimizations are depends on the size of applications, type and other factors but normally we consider following optimizing points i.e. 1.          Consider AOT compilation. 2.          Consider lazy loading instead of fully bundled app if the app size is more. 3.          Keep in mind, your application is bundled and disfeatured. 4.          Keep in mind, your application doesn’t have un-necessary import statements. 5.          Keep in mind, your application’s 3rd party unused library. If exist and not used, removed from your application. 6.          Remove your application dependencies if not required. Stayed Informed   –   Angular 2 Tutorials | Angular 2 Quick Start Docs   I hope you are enjoying with thi...

Setup and Install Typescript NPM and Angular 2

Two main ways to Installing the TypeScript, 1.      Installing using npm 2.      Installing TypeScript’s Visual Studio plugins In the Visual Studio 2017, TypeScript include by default. If you don’t have TypeScript with Visual Studio, try for NPM users, > npm install - g typescript Stayed Informed   -   Setup and  Installing   Angular 2 Example-1 class Users { userName: string ; constructor (name: string ) { this .userName = name; } getUserName() { return "Hello, " + this .userName; } } Example -2 class Users { private firstName: string ; private lastName: string ; //Constructor constructor (firstName: string , lastName: string ) { this .firstName = firstName; this .lastName = lastName; } //Function studentFullName() : void { alert( this .firstName + ' ' + this .las...

Angular 2 CRUD Operation MVC demo Example

How to Create a CRUD App with Angular 2? Try below links for Angular 2 CRUD, Angular 2 CRUD Operations - http://stackoverflow.com/questions/39138467/crud-operation-in-angular2 Angular 2 CRUD - Running End To End https://github.com/loiane/angular2-crud-rest Create a CRUD App with Angular CLI and TypeScript http://adrianmejia.com/blog/2016/10/01/Angular-2-Tutorial-Create-a-CRUD-App-with-Angular-CLI-and-TypeScript/ Angular 2 User Registration and Login Example & Tutorial http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial Angular 2 CRUD application using Nodejs http://www.codershood.info/2016/10/23/angular-2-crud-application-using-nodejs/ Angular 2 CRUD, modals, animations, pagination, datetimepicker and much more https://chsakell.com/2016/06/27/angular-2-crud-modals-animations-pagination-datetimepicker/ I hope you are enjoying with this post! Please share with you friends. Thank you!!

Angular 2 @Inject vs. @Injectable [Why @Inject and @Injectable?]

What are the difference between @Inject and @Injectable? @Inject() - Angular 2 Angular 2 @Inject() is a special technique for letting Angular know that a parameter must be injected. Stayed Informed - Why @Injectable() in Angular 2? Example as, import { Inject } from '@angular/core' ; import { Http } from '@angular/http' ; class UserService { users: Array < any > ; constructor ( @ Inject(Http) http: Http ) { //TODO AS PER YOU. } } @Injectable() - Angular 2 @Injectable() marks a class as available to an injector for instantiation. An injector reports an error when trying to instantiate a class that is not marked as @Injectable() . How to use Dependency Injection (DI) correctly in Angular 2? The basics Steps of Dependency injection, 1.       A class with @Injectable() to tell angular 2 that it’s to be injected “UserService”. 2.       A class with a constructor that accepts a ...