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
element.addEventListener('keyup', function () { | |
console.log('Key pressed.'); | |
}); | |
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
<select> | |
<option value="volvo">Volvo</option> | |
<option value="saab">Saab</option> | |
<option value="audi">Audi</option> | |
</select> | |
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
<section class="sample-app-content"> | |
<h1>Template-driven Form Example (with bi-directional data binding):</h1> | |
<form #myForm="ngForm" (ngSubmit)="onSubmitTemplateBased()"> | |
<p> | |
<label>First Name:</label> | |
<input type="text" | |
[(ngModel)]="user.firstName" required> | |
</p> | |
<p> | |
<label>Password:</label> |
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 $ = require('jquery'); | |
$('body').append("I've imported jQuery!"); | |
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
{ | |
todos:[ | |
{ | |
"id":1, | |
"description":"TODO 1", | |
"completed":false | |
}, | |
{ | |
"id":2, | |
"description":"TODO 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 {HelloWorld} | |
from 'angular-library-example/components'; | |
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
const obs = interval(1000).pipe(take(5)); | |
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
export class AddTodoAction { | |
constructor(public newTodo: Todo) { | |
} | |
} | |
export class ToggleTodoAction { | |
constructor(public todo: Todo) { | |
} |
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
// this is the new version of addEventListener | |
function addEventListener(eventName, callback) { | |
// call the real addEventListener | |
callRealAddEventListener(eventName, function() { | |
// first call the original callback | |
callback(...); | |
// and then run Angular-specific functionality | |
var changed = angular.runChangeDetection(); | |
if (changed) { | |
angular.reRenderUIPart(); |
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 {ng2engine} from 'angular2-universal'; | |
let app = express(); | |
// config view engine | |
app.engine('.html', ng2engine); | |
app.set('views', __dirname); | |
app.set('view engine', 'html'); | |
// config the root route |