chore(material): migrate most components to TypeScript.
This commit is contained in:
12
modules/examples/src/material/.clang-format
Normal file
12
modules/examples/src/material/.clang-format
Normal file
@ -0,0 +1,12 @@
|
||||
Language: JavaScript
|
||||
BasedOnStyle: Google
|
||||
ColumnLimit: 100
|
||||
|
||||
TabWidth: 2
|
||||
ContinuationIndentWidth: 4
|
||||
MaxEmptyLinesToKeep : 2
|
||||
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
@ -1,21 +1,13 @@
|
||||
import {bootstrap, MapWrapper, ListWrapper, NgFor} from 'angular2/angular2';
|
||||
import {MdButton, MdAnchor} from 'angular2_material/src/components/button/button'
|
||||
import {bootstrap, Component, View, NgFor} from 'angular2/angular2';
|
||||
import {MdButton, MdAnchor} from 'angular2_material/src/components/button/button';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app'
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdButton, MdAnchor, NgFor]
|
||||
})
|
||||
@Component({selector: 'demo-app'})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdButton, MdAnchor, NgFor]})
|
||||
class DemoApp {
|
||||
previousClick: string;
|
||||
action: string;
|
||||
@ -26,7 +18,7 @@ class DemoApp {
|
||||
this.previousClick = 'Nothing';
|
||||
this.action = "ACTIVATE";
|
||||
this.clickCount = 0;
|
||||
this.items = [1,2,3,4,5,6,7,8,9,0];
|
||||
this.items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
||||
}
|
||||
|
||||
click(msg: string) {
|
||||
@ -45,7 +37,5 @@ class DemoApp {
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {MdCheckbox} from 'angular2_material/src/components/checkbox/checkbox'
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app'
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdCheckbox]
|
||||
})
|
||||
class DemoApp {
|
||||
toggleCount: number;
|
||||
|
||||
constructor() {
|
||||
this.toggleCount = 0;
|
||||
}
|
||||
|
||||
increment() {
|
||||
this.toggleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
}
|
24
modules/examples/src/material/checkbox/index.ts
Normal file
24
modules/examples/src/material/checkbox/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {bootstrap, Component, Directive, View} from 'angular2/angular2';
|
||||
import {MdCheckbox} from 'angular2_material/src/components/checkbox/checkbox';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
@Component({selector: 'demo-app'})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdCheckbox]})
|
||||
class DemoApp {
|
||||
toggleCount: number;
|
||||
|
||||
constructor() {
|
||||
this.toggleCount = 0;
|
||||
}
|
||||
|
||||
increment() {
|
||||
this.toggleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
import {IMPLEMENTS, print} from 'angular2/src/facade/lang';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {isPresent, isBlank, RegExpWrapper, StringWrapper, BaseException} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Injectable} from 'angular2/src/di/annotations_impl';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||
|
||||
export function commonDemoSetup(): void {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class DemoUrlResolver extends UrlResolver {
|
||||
static a;
|
||||
|
||||
isInPubServe:boolean;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
if (isBlank(UrlResolver.a)) {
|
||||
UrlResolver.a = DOM.createElement('a');
|
||||
}
|
||||
this.isInPubServe = _isInPubServe();
|
||||
}
|
||||
|
||||
resolve(baseUrl: string, url: string): string {
|
||||
if (isBlank(baseUrl)) {
|
||||
DOM.resolveAndSetHref(UrlResolver.a, url, null);
|
||||
return DOM.getHref(UrlResolver.a);
|
||||
}
|
||||
|
||||
if (isBlank(url) || url == '') return baseUrl;
|
||||
|
||||
if (url[0] == '/') {
|
||||
throw new BaseException(`Could not resolve the url ${url} from ${baseUrl}`);
|
||||
}
|
||||
|
||||
var m = RegExpWrapper.firstMatch(_schemeRe, url);
|
||||
|
||||
if (isPresent(m[1])) {
|
||||
return url;
|
||||
}
|
||||
|
||||
if (StringWrapper.startsWith(url, './')) {
|
||||
return `${baseUrl}/${url}`;
|
||||
}
|
||||
|
||||
// Whether the `examples/` dir is being directly served (as the server root).
|
||||
// For cases when this is not true AND we're in pub-serve, `examples/` needs to be
|
||||
// prepended to the URL.
|
||||
var isDirectlyServingExamplesDir = !StringWrapper.contains(baseUrl, 'examples/');
|
||||
|
||||
if (this.isInPubServe && isDirectlyServingExamplesDir) {
|
||||
return `/packages/${url}`;
|
||||
} else if (this.isInPubServe) {
|
||||
return `/examples/packages/${url}`;
|
||||
} else {
|
||||
return `/${url}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _schemeRe = RegExpWrapper.create('^([^:/?#]+:)?');
|
||||
|
||||
// TODO: remove this hack when http://dartbug.com/23128 is fixed
|
||||
function _isInPubServe():boolean {
|
||||
try {
|
||||
int.parse('123');
|
||||
print('>> Running in Dart');
|
||||
return true;
|
||||
} catch(_) {
|
||||
print('>> Running in JS');
|
||||
return false;
|
||||
}
|
||||
}
|
87
modules/examples/src/material/demo_common.ts
Normal file
87
modules/examples/src/material/demo_common.ts
Normal file
@ -0,0 +1,87 @@
|
||||
import {IMPLEMENTS, print} from 'angular2/src/facade/lang';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {
|
||||
isPresent,
|
||||
isBlank,
|
||||
RegExpWrapper,
|
||||
StringWrapper,
|
||||
BaseException
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Injectable} from 'angular2/di';
|
||||
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
|
||||
import {reflector} from 'angular2/src/reflection/reflection';
|
||||
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
|
||||
|
||||
|
||||
export function commonDemoSetup(): void {
|
||||
BrowserDomAdapter.makeCurrent();
|
||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class DemoUrlResolver extends UrlResolver {
|
||||
static a;
|
||||
|
||||
isInPubServe: boolean;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
if (isBlank(UrlResolver.a)) {
|
||||
UrlResolver.a = DOM.createElement('a');
|
||||
}
|
||||
this.isInPubServe = _isInPubServe();
|
||||
}
|
||||
|
||||
resolve(baseUrl: string, url: string): string {
|
||||
if (isBlank(baseUrl)) {
|
||||
DOM.resolveAndSetHref(UrlResolver.a, url, null);
|
||||
return DOM.getHref(UrlResolver.a);
|
||||
}
|
||||
|
||||
if (isBlank(url) || url == '') {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
if (url[0] == '/') {
|
||||
throw new BaseException(`Could not resolve the url ${url} from ${baseUrl}`);
|
||||
}
|
||||
|
||||
var m = RegExpWrapper.firstMatch(_schemeRe, url);
|
||||
|
||||
if (isPresent(m[1])) {
|
||||
return url;
|
||||
}
|
||||
|
||||
if (StringWrapper.startsWith(url, './')) {
|
||||
return `${baseUrl}/${url}`;
|
||||
}
|
||||
|
||||
// Whether the `examples/` dir is being directly served (as the server root).
|
||||
// For cases when this is not true AND we're in pub-serve, `examples/` needs to be
|
||||
// prepended to the URL.
|
||||
var isDirectlyServingExamplesDir = !StringWrapper.contains(baseUrl, 'examples/');
|
||||
|
||||
if (this.isInPubServe && isDirectlyServingExamplesDir) {
|
||||
return `/packages/${url}`;
|
||||
} else if (this.isInPubServe) {
|
||||
return `/examples/packages/${url}`;
|
||||
} else {
|
||||
return `/${url}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _schemeRe = RegExpWrapper.create('^([^:/?#]+:)?');
|
||||
|
||||
// TODO: remove this hack when http://dartbug.com/23128 is fixed
|
||||
function _isInPubServe(): boolean {
|
||||
try {
|
||||
int.parse('123');
|
||||
print('>> Running in Dart');
|
||||
return true;
|
||||
} catch (_) {
|
||||
print('>> Running in JS');
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {MdGridList, MdGridTile} from 'angular2_material/src/components/grid_list/grid_list'
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app'
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdGridList, MdGridTile]
|
||||
})
|
||||
class DemoApp {
|
||||
tile3RowSpan: number;
|
||||
tile3ColSpan: number;
|
||||
|
||||
constructor() {
|
||||
this.tile3RowSpan = 3;
|
||||
this.tile3ColSpan = 3;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
}
|
22
modules/examples/src/material/grid_list/index.ts
Normal file
22
modules/examples/src/material/grid_list/index.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {MdGridList, MdGridTile} from 'angular2_material/src/components/grid_list/grid_list';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
@Component({selector: 'demo-app'})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdGridList, MdGridTile]})
|
||||
class DemoApp {
|
||||
tile3RowSpan: number;
|
||||
tile3ColSpan: number;
|
||||
|
||||
constructor() {
|
||||
this.tile3RowSpan = 3;
|
||||
this.tile3ColSpan = 3;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
@ -34,10 +34,10 @@
|
||||
<input disabled value="Firefly">
|
||||
</md-input-container>
|
||||
|
||||
<h3>textarea</h3>
|
||||
<!--<h3>textarea</h3>
|
||||
<md-input-container>
|
||||
<label>What I did on my summer vaccation</label>
|
||||
<textarea></textarea>
|
||||
</md-input-container>
|
||||
</md-input-container>-->
|
||||
|
||||
</div>
|
||||
|
@ -1,30 +0,0 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {MdInputContainer, MdInput, MdTextarea} from 'angular2_material/src/components/input/input'
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app'
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdInputContainer, MdInput, MdTextarea]
|
||||
})
|
||||
class DemoApp {
|
||||
constructor() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
}
|
16
modules/examples/src/material/input/index.ts
Normal file
16
modules/examples/src/material/input/index.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {MdInputContainer, MdInput} from 'angular2_material/src/components/input/input';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
@Component({selector: 'demo-app'})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdInputContainer, MdInput]})
|
||||
class DemoApp {
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {MdProgressLinear} from 'angular2_material/src/components/progress-linear/progress_linear'
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app'
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdProgressLinear]
|
||||
})
|
||||
class DemoApp {
|
||||
progress: number;
|
||||
|
||||
constructor() {
|
||||
this.progress = 40;
|
||||
}
|
||||
|
||||
step(s: number) {
|
||||
this.progress += s;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
}
|
24
modules/examples/src/material/progress-linear/index.ts
Normal file
24
modules/examples/src/material/progress-linear/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {MdProgressLinear} from 'angular2_material/src/components/progress-linear/progress_linear';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
@Component({selector: 'demo-app'})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdProgressLinear]})
|
||||
class DemoApp {
|
||||
progress: number;
|
||||
|
||||
constructor() {
|
||||
this.progress = 40;
|
||||
}
|
||||
|
||||
step(s: number) {
|
||||
this.progress += s;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
@ -1,23 +1,12 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {MdRadioButton, MdRadioGroup} from 'angular2_material/src/components/radio/radio_button'
|
||||
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher'
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {MdRadioButton, MdRadioGroup} from 'angular2_material/src/components/radio/radio_button';
|
||||
import {MdRadioDispatcher} from 'angular2_material/src/components/radio/radio_dispatcher';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app',
|
||||
appInjector: [MdRadioDispatcher]
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdRadioGroup, MdRadioButton]
|
||||
})
|
||||
@Component({selector: 'demo-app', appInjector: [MdRadioDispatcher]})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdRadioGroup, MdRadioButton]})
|
||||
class DemoApp {
|
||||
thirdValue;
|
||||
groupValueChangeCount;
|
||||
@ -48,7 +37,5 @@ class DemoApp {
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
import {bootstrap} from 'angular2/angular2';
|
||||
import {MdSwitch} from 'angular2_material/src/components/switcher/switch'
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
// TODO(radokirov): Once the application is transpiled by TS instead of Traceur,
|
||||
// add those imports back into 'angular2/angular2';
|
||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
|
||||
@Component({
|
||||
selector: 'demo-app'
|
||||
})
|
||||
@View({
|
||||
templateUrl: './demo_app.html',
|
||||
directives: [MdSwitch]
|
||||
})
|
||||
class DemoApp {
|
||||
toggleCount: number;
|
||||
|
||||
constructor() {
|
||||
this.toggleCount = 0;
|
||||
}
|
||||
|
||||
increment() {
|
||||
this.toggleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [
|
||||
bind(UrlResolver).toValue(new DemoUrlResolver())
|
||||
]);
|
||||
}
|
24
modules/examples/src/material/switcher/index.ts
Normal file
24
modules/examples/src/material/switcher/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {bootstrap, Component, View} from 'angular2/angular2';
|
||||
import {MdSwitch} from 'angular2_material/src/components/switcher/switch';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {commonDemoSetup, DemoUrlResolver} from '../demo_common';
|
||||
import {bind} from 'angular2/di';
|
||||
|
||||
@Component({selector: 'demo-app'})
|
||||
@View({templateUrl: './demo_app.html', directives: [MdSwitch]})
|
||||
class DemoApp {
|
||||
toggleCount: number;
|
||||
|
||||
constructor() {
|
||||
this.toggleCount = 0;
|
||||
}
|
||||
|
||||
increment() {
|
||||
this.toggleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
export function main() {
|
||||
commonDemoSetup();
|
||||
bootstrap(DemoApp, [bind(UrlResolver).toValue(new DemoUrlResolver())]);
|
||||
}
|
Reference in New Issue
Block a user