X Tutup
Skip to content

Commit f9fb72f

Browse files
committed
chore(core): remove @view annotation
Closes angular#7495
1 parent 095db67 commit f9fb72f

File tree

85 files changed

+588
-599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+588
-599
lines changed

TOOLS_JS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ speed things up is to use plain class fields in your expressions and avoid any
117117
kinds of computation. Example:
118118

119119
```typescript
120-
@View({
120+
@Component({
121121
template: '<button [enabled]="isEnabled">{{title}}</button>'
122122
})
123123
class FancyButton {

modules/angular2/docs/core/02_directives.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ Example of a component:
112112
'title', | - title mapped to component title
113113
'open' | - open attribute mapped to component's open property
114114
], |
115-
}) |
116-
@View({ | View annotation
117-
templateUrl: 'pane.html' | - URL of template HTML
115+
templateUrl: 'pane.html' | URL of template HTML
118116
}) |
119117
class Pane { | Component controller class
120118
title:string; | - title property
@@ -227,11 +225,9 @@ class MyService {} | Assume a service which needs to be inject
227225
|
228226
@Component({ | Assume a top level application component which
229227
selector: 'my-app', | configures the services to be injected.
230-
viewBindings: [MyService] |
231-
}) |
232-
@View({ | Assume we have a template that needs to be
233-
templateUrl: 'my_app.html', | configured with directives to be injected.
234-
directives: [House] |
228+
viewBindings: [MyService], |
229+
templateUrl: 'my_app.html', | Assume we have a template that needs to be
230+
directives: [House] | configured with directives to be injected.
235231
}) |
236232
class MyApp {} |
237233
|
@@ -273,8 +269,6 @@ Here is an example of the kinds of injections which can be achieved:
273269
```
274270
@Component({ |
275271
selector: 'my-app' |
276-
}) |
277-
@View({ |
278272
templateUrl: 'my_app.html', |
279273
directives: [Form, FieldSet, |
280274
Field, Primary] |
@@ -329,8 +323,6 @@ Shadow DOM provides an encapsulation for components, so as a general rule it doe
329323
```
330324
@Component({
331325
selector: '[kid]'
332-
})
333-
@View({
334326
templateUrl: 'kid.html',
335327
directives: []
336328
})
@@ -347,8 +339,6 @@ class Kid {
347339
348340
@Component({
349341
selector: '[dad]'
350-
})
351-
@View({
352342
templateUrl: 'dad.html',
353343
directives: [Kid]
354344
})
@@ -361,9 +351,7 @@ class Dad {
361351
362352
@Component({
363353
selector: '[grandpa]',
364-
viewBindings: []
365-
})
366-
@View({
354+
viewBindings: [],
367355
templateUrl: 'grandpa.html',
368356
directives: [Dad]
369357
})

modules/angular2/docs/di/di_advanced.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ Both `MyComponent` and `MyDirective` are created on the same element.
179179
],
180180
viewBindings: [
181181
bind('viewService').toValue('View_MyComponentService')
182-
]
183-
})
184-
@View({
182+
],
185183
template: `<needs-view-service></needs-view-service>`,
186184
directives: [NeedsViewService]
187185
})

modules/angular2/src/common/common_directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {CORE_DIRECTIVES} from './directives';
99
* NgModel).
1010
*
1111
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
12-
* property of the `@Component` or `@View` decorators.
12+
* property of the `@Component` decorator.
1313
*
1414
* ### Example
1515
*

modules/angular2/src/common/directives/core_directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {NgPlural, NgPluralCase} from './ng_plural';
1111
* application.
1212
*
1313
* This collection can be used to quickly enumerate all the built-in directives in the `directives`
14-
* property of the `@View` annotation.
14+
* property of the `@Component` annotation.
1515
*
1616
* ### Example ([live demo](http://plnkr.co/edit/yakGwpCdUkg0qfzX5m8g?p=preview))
1717
*

modules/angular2/src/common/directives/ng_switch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export class SwitchView {
3232
* ### Example ([live demo](http://plnkr.co/edit/DQMTII95CbuqWrl3lYAs?p=preview))
3333
*
3434
* ```typescript
35-
* @Component({selector: 'app'})
36-
* @View({
35+
* @Component({
36+
* selector: 'app',
3737
* template: `
3838
* <p>Value = {{value}}</p>
3939
* <button (click)="inc()">Increment</button>

modules/angular2/src/common/forms/directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export {ControlValueAccessor} from './directives/control_value_accessor';
5050

5151
/**
5252
*
53-
* A list of all the form directives used as part of a `@View` annotation.
53+
* A list of all the form directives used as part of a `@Component` annotation.
5454
*
5555
* This is a shorthand for importing them each individually.
5656
*

modules/angular2/src/common/forms/directives/ng_control_group.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ const controlGroupProvider =
3333
* @Component({
3434
* selector: 'my-app',
3535
* directives: [FORM_DIRECTIVES],
36-
* })
37-
* @View({
3836
* template: `
3937
* <div>
4038
* <h2>Angular2 Control &amp; ControlGroup Example</h2>

modules/angular2/src/common/pipes/common_pipes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {CONST_EXPR} from 'angular2/src/facade/lang';
2020
* application.
2121
*
2222
* This collection can be used to quickly enumerate all the built-in pipes in the `pipes`
23-
* property of the `@Component` or `@View` decorators.
23+
* property of the `@Component` decorator.
2424
*/
2525
export const COMMON_PIPES = CONST_EXPR([
2626
AsyncPipe,

modules/angular2/src/core/linker/view_resolver.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class ViewResolver {
4545
if (isPresent(compMeta)) {
4646
if (isBlank(compMeta.template) && isBlank(compMeta.templateUrl) && isBlank(viewMeta)) {
4747
throw new BaseException(
48-
`Component '${stringify(component)}' must have either 'template', 'templateUrl', or '@View' set.`);
48+
`Component '${stringify(component)}' must have either 'template' or 'templateUrl' set.`);
4949

5050
} else if (isPresent(compMeta.template) && isPresent(viewMeta)) {
5151
this._throwMixingViewAndComponent("template", component);
@@ -84,7 +84,8 @@ export class ViewResolver {
8484
}
8585
} else {
8686
if (isBlank(viewMeta)) {
87-
throw new BaseException(`No View decorator found on component '${stringify(component)}'`);
87+
throw new BaseException(
88+
`Could not compile '${stringify(component)}' because it is not a component.`);
8889
} else {
8990
return viewMeta;
9091
}

0 commit comments

Comments
 (0)
X Tutup