This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'my-app', | |
| template: ` | |
| <h1>Testing the Angular Component</h1> | |
| `, | |
| }) | |
| class TestComponent { | |
| counter = 0; | |
| name = 'Angular 2' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Directive, ElementRef} from 'angular2/angular2'; | |
| @Directive({ | |
| selector: "[link]", | |
| hostListeners: { | |
| 'mouseenter': 'onMouseEnter()', | |
| 'mouseleave': 'onMouseLeave()' | |
| } | |
| }) | |
| class LinkHighlight { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $scope.$watch('myValue', function(newValue, oldValue) { | |
| //update the DOM with newValue | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var start, | |
| time = 0; | |
| timer = performance ? performance.now : Date.now; | |
| // start timer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doSomething() { | |
| console.log('Async task'); | |
| } | |
| // start timer | |
| start = timer(); | |
| foo(); | |
| setTimeout(doSomething, 2000); | |
| bar(); | |
| baz(); | |
| // stop timer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function main() { | |
| foo(); | |
| setTimeout(doSomething, 2000); | |
| bar(); | |
| baz(); | |
| } | |
| zone.run(main); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function main() { | |
| foo(); | |
| setTimeout(doSomething, 2000); | |
| bar(); | |
| baz(); | |
| } | |
| var myZoneSpec = { | |
| beforeTask: function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'progress-bar', | |
| template: ` | |
| <h3>Progress: {{progress}}</h3> | |
| <button (click)="processWithinAngularZone()"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'progress-bar', | |
| template: ` | |
| <h3>Progress: {{progress}}</h3> | |
| <button (click)="processWithinAngularZone()"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NgModule } from '@angular/core'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { AppComponent } from './app.component'; | |
| import { EagerComponent } from './eager.component'; | |
| import { routing } from './app.routing'; | |
| @NgModule({ | |
| imports: [ | |
| BrowserModule, |
OlderNewer