chore(rename): rename View and Template concepts for #1244
This commit is contained in:

committed by
Jeremy Elbourn

parent
564477b8a0
commit
bf7933714a
@ -1,4 +1,4 @@
|
||||
import {bootstrap, Component, Decorator, Template, If, For, EventEmitter} from 'angular2/angular2';
|
||||
import {bootstrap, Component, Decorator, View, If, For, EventEmitter} from 'angular2/angular2';
|
||||
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||
|
||||
// HeaderFields renders the bound header control group. It can used as follows:
|
||||
@ -8,12 +8,12 @@ import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/fo
|
||||
// This component is self-contained and can be tested in isolation.
|
||||
@Component({
|
||||
selector: 'survey-header',
|
||||
bind: {
|
||||
properties: {
|
||||
"header" : "header"
|
||||
}
|
||||
})
|
||||
@Template({
|
||||
inline: `
|
||||
@View({
|
||||
template: `
|
||||
<div [control-group]="header">
|
||||
<div>
|
||||
<label>Title:</label> <br/>
|
||||
@ -53,13 +53,13 @@ class HeaderFields {
|
||||
// This component is self-contained and can be tested in isolation.
|
||||
@Component({
|
||||
selector: 'survey-question',
|
||||
bind: {
|
||||
properties: {
|
||||
"question" : "question",
|
||||
"index" : "index"
|
||||
}
|
||||
})
|
||||
@Template({
|
||||
inline: `
|
||||
@View({
|
||||
template: `
|
||||
<h2>Question #{{index}}</h2>
|
||||
|
||||
<button (click)="deleteQuestion()">Delete</button>
|
||||
@ -118,10 +118,10 @@ class SurveyQuestion {
|
||||
// SurveyBuilder is a form that allows you to create a survey.
|
||||
@Component({
|
||||
selector: 'survey-builder-app',
|
||||
services: [FormBuilder]
|
||||
injectables: [FormBuilder]
|
||||
})
|
||||
@Template({
|
||||
inline: `
|
||||
@View({
|
||||
template: `
|
||||
<h1>Create New Survey</h1>
|
||||
|
||||
<div [control-group]="form">
|
||||
@ -194,4 +194,4 @@ class SurveyBuilder {
|
||||
|
||||
export function main() {
|
||||
bootstrap(SurveyBuilder);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {bootstrap, Component, Template} from 'angular2/angular2';
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
||||
@Component({selector: 'gestures-app'})
|
||||
@Template({url: 'template.html'})
|
||||
@View({templateUrl: 'template.html'})
|
||||
class GesturesCmp {
|
||||
swipeDirection: string;
|
||||
pinchScale: number;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bootstrap, Component, Decorator, Template, NgElement} from 'angular2/angular2';
|
||||
import {bootstrap, Component, Decorator, View, NgElement} from 'angular2/angular2';
|
||||
import {Injectable} from 'angular2/di';
|
||||
|
||||
// Angular 2.0 supports 3 basic types of directives:
|
||||
@ -16,13 +16,13 @@ import {Injectable} from 'angular2/di';
|
||||
selector: 'hello-app',
|
||||
// These are services that would be created if a class in the component's
|
||||
// template tries to inject them.
|
||||
services: [GreetingService]
|
||||
injectables: [GreetingService]
|
||||
})
|
||||
// The template for the component.
|
||||
@Template({
|
||||
@View({
|
||||
// Expressions in the template (like {{greeting}}) are evaluated in the
|
||||
// context of the HelloCmp class below.
|
||||
inline: `<div class="greeting">{{greeting}} <span red>world</span>!</div>
|
||||
template: `<div class="greeting">{{greeting}} <span red>world</span>!</div>
|
||||
<button class="changeButton" (click)="changeGreeting()">change greeting</button><content></content>`,
|
||||
// All directives used in the template need to be specified. This allows for
|
||||
// modularity (RedDec can only be used in this template)
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as app from './index_common';
|
||||
|
||||
import {Component, Decorator, Template, NgElement} from 'angular2/angular2';
|
||||
import {Component, Decorator, View, NgElement} from 'angular2/angular2';
|
||||
import {Lexer, Parser, ChangeDetection, ChangeDetector} from 'angular2/change_detection';
|
||||
import {ExceptionHandler} from 'angular2/src/core/exception_handler';
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
@ -39,11 +39,11 @@ function setup() {
|
||||
"annotations" : [
|
||||
new Component({
|
||||
selector: 'hello-app',
|
||||
services: [app.GreetingService]
|
||||
injectables: [app.GreetingService]
|
||||
}),
|
||||
new Template({
|
||||
new View({
|
||||
directives: [app.RedDec],
|
||||
inline: `<div class="greeting">{{greeting}} <span red>world</span>!</div>
|
||||
template: `<div class="greeting">{{greeting}} <span red>world</span>!</div>
|
||||
<button class="changeButton" (click)="changeGreeting()">change greeting</button>`
|
||||
})]
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bootstrap, Component, Template} from 'angular2/angular2';
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {KeyEventsPlugin} from 'angular2/src/render/dom/events/key_events';
|
||||
|
||||
// 2 imports for the Dart version:
|
||||
@ -6,10 +6,10 @@ import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
|
||||
@Component({
|
||||
selector: 'key-events-app',
|
||||
selector: 'key-events-app'
|
||||
})
|
||||
@Template({
|
||||
inline: `Click in the following area and press a key to display its name:<br>
|
||||
@View({
|
||||
template: `Click in the following area and press a key to display its name:<br>
|
||||
<div (keydown)="onKeyDown($event)" class="sample-area" tabindex="0">{{lastKey}}</div><br>
|
||||
Click in the following area and press shift.enter:<br>
|
||||
<div
|
||||
|
@ -1,15 +1,15 @@
|
||||
import {bootstrap, Component, Template, For} from 'angular2/angular2';
|
||||
import {bootstrap, Component, View, For} from 'angular2/angular2';
|
||||
import {Store, Todo, TodoFactory} from './services/TodoStore';
|
||||
|
||||
@Component({
|
||||
selector: 'todo-app',
|
||||
services: [
|
||||
injectables: [
|
||||
Store,
|
||||
TodoFactory
|
||||
]
|
||||
})
|
||||
@Template({
|
||||
url: 'todo.html',
|
||||
@View({
|
||||
templateUrl: 'todo.html',
|
||||
directives: [For]
|
||||
})
|
||||
class TodoApp {
|
||||
|
Reference in New Issue
Block a user