Angular 2 is more of a component based architecture. You can assume everything as component, like directives, services and so on.
While directives and services are actually for the support of base components, they are also defined in a similar fashion.
A base component contains dependencies, view details and a class declaration which may be considered as controller.
So, a well defined component contain one set of MVC architecture.
for example (angular 2 alpha version) :
import {Component, View, bootstrap, provide, NgClass} from 'angular2/angular2';
@Component({
selector : "my-home"
})
@View({
directives : [NgClass, EditSettingPanel],
styles: ['.hidden{ display : none} .visible{ display : block}'],
templateUrl : "views/blog-panel.html"
})
export class home {
}
}
In the above example you can see that class "home" may be assumed as controller, View is written with @View decorator. The component customization is given by @component decorator.
Also you can see different dependencies injection practice.
EDIT ::
Example (Current angular 2/4 version)
import { Component } from '@angular/core';
@Component({
selector: 'custom-component',
templateUrl: './template.html',
styleUrls: ['./style.scss'],
})
export class CustomComponent {}
In a nutshell, angular 2 is a component based MVC framework.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…