Angular 1x | Angular 2x |
1Uses many tags like ng-href, ng-src, ng-show and ng-hide | All these directives are no longer required |
2.Can use languages like Es5, ES6 and Dart | Can use languages like ES5, |
3. Controllers and scopes are used | Controllers are replaced with Components |
4. Has 2 ways to bootstrap angular via code and ng-app. | The only way to bootstrap angular is via code. |
(The bootstrap function is used and it takes starting component which is also parent component of your angular application.) |
5. To filter output in templates, we use the pipe character (|) and one or more filters | In Angular 2 they are called pipes. The syntax remains same. |
6.Was not built with mobile support | Mobile oriented |
7. Event binding is done as <button ng-click="doSomething()"> | Event binding is done as <button (click)="doSomething()"> |
8. ng-bind is used for one way data binding | ng-bind is replaced with [property] |
9. ng-model is used for two way data binding | ng-model is replaced with [(ngModel)] |
10. we can define a service via 5 different ways.- Factory
- Service
- Provider
- Constant
- Values
| class is the only way to define a service |
11 Dependency Injection is achieved using controller function arguments | DI is achieved using Constructor |
12. $routeProvider.when() is used to configuring routing. | @RouteConfig{(...}) is used to configuring routing. |
13. Structural directives like ng-repeat, ng-if are used | Structural directives like #ngfor, *ngif are used |