I've got many links which introduce MVC, MVP, MVVM and so on. But I didn't get one which tells what M exactly stands for in Angular2, what V exactly stands for in Angular2 and what W exactly stands for in Angular2. Maybe there is an answer for W. That is W stands for whatever.
Can anyone help me with the following example.
AppModule:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { AppService } from './app.service';
@NgModule({
imports: [
BrowserModule
],
providers: [ AppService ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
AppComponent:
import { Component } from '@angular/core';
import { AppService } from './app.service';
import { Message } from './message';
@Component({
selector: 'my-app',
template: '<h1>{{message.body}}</h1>from<h2>{{message.sender}}</h2>',
})
export class AppComponent {
private message: Message;
constructor(appService: AppService) {
this.message = userService.getMessage();
}
}
Message:
export class Message {
private body: string;
private sender: string;
constructor() {
this.body = 'hello, world';
this.sender = 'Lcng';
}
}
AppService:
import { Injectable } from '@angular/core';
import { Message } from './message';
@Injectable()
export class AppService {
getMessage(): Message{
let message = new Message();
return message;
}
}
So my understanding is:
M (of course it stands for Model) is the Domain Model. And in the above example the Domain Module is the AppService. So most of the time M is the services(except something like utility services).
V is View, which is rendered by a Component's template. In the above example V is the greeting screen.
W is whatever. And it is the Component which looks like a Controller, a ViewModel, and a whatever..
And, the class Message in the above example is a Entity Model which is not the M..
So am I right? Could you help me please..