This file contains 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 { SharedModule } from './shared/shared.module'; | |
import { AppComponent } from './app.component'; | |
import { EagerComponent } from './eager.component'; | |
import { routing } from './app.routing'; | |
@NgModule({ | |
imports: [ | |
BrowserModule, |
This file contains 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 mySubject = new Rx.Subject(); | |
const myObs = mySubject.asObservable(); | |
mySubject.next('Hello'); | |
myObs.next('World!'); // TypeError: myObs.next is not a function |
This file contains 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
<p> | |
Choose your favorite transuranic element (actinide or transactinide). | |
</p> | |
<div class="listbox-area"> | |
<div class="left-area"> | |
<span id="exp_elem"> | |
Choose an element: | |
</span> | |
<div id="exp_wrapper"> | |
<button aria-haspopup="listbox" |
This file contains 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
<div> // div A | |
<app-my-component> | |
<div> | |
this is some content for the component app-my-component | |
</div> | |
</app-my-component> | |
</div> // div B |
This file contains 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: 'app-my-component', | |
template: ` | |
<div> // div C | |
here is the View HTML but below we receive content html | |
<ng-content></ng-content> | |
</div> // div D | |
` | |
}) |
This file contains 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 {Component, OnChanges, SimpleChanges, Input} from '@angular/core'; | |
import { Employee } from './employee'; | |
@Component({ | |
selector: 'app-emp', | |
templateUrl: './employee.component.html' | |
}) | |
export class EmployeeComponent implements OnChanges { | |
@Input() employee: Employee; |
This file contains 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 user = { | |
name: 'John Due', | |
birthdate: '1988-08-15', | |
} | |
const changeName = (user, newName) => { | |
const newUser = user | |
newUser.name = newName | |
return newUser | |
} |
This file contains 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
// very simplified version of actual source | |
class ApplicationRef { | |
changeDetectorRefs:ChangeDetectorRef[] = []; | |
constructor(private zone: NgZone) { | |
this.zone.onTurnDone | |
.subscribe(() => this.zone.run(() => this.tick()); | |
} |
This file contains 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(); |
OlderNewer