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
<md-form-field> | |
<input mdInput [mdDatepicker]="picker" placeholder="Choose a date"> | |
<md-datepicker-toggle mdSuffix [for]="picker"></md-datepicker-toggle> | |
<md-datepicker #picker></md-datepicker> | |
</md-form-field> |
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 { Component } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<nav> | |
<h2>Menu:</h2> | |
<a routerLink="classic">Classic component</a> | |
<a routerLink="lazy">Lazy loaded component</a> | |
</nav> |
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 { ModuleWithProviders, NgModule } from '@angular/core'; | |
import { Routes, RouterModule } from '@angular/router'; | |
import { ClassicComponent } from './classic.component'; | |
@NgModule({ | |
imports: [ | |
RouterModule.forRoot([ | |
{ path: '', redirectTo: 'classic', pathMatch: 'full' }, | |
{ path: 'classic', component: ClassicComponent }, | |
{ path: 'lazy', loadChildren: 'app/lazy/lazy.module#LazyModule' } |
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 { Component } from '@angular/core'; | |
@Component({ | |
template: '<p>Lazy Component</p>' | |
}) | |
export class LazyComponent {} |
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 { ModuleWithProviders, NgModule } from '@angular/core'; | |
import { Routes, RouterModule } from '@angular/router'; | |
import { LazyComponent } from './lazy.component'; | |
@NgModule({ | |
imports: [ | |
RouterModule.forChild([ | |
{ path: '', component: LazyComponent } | |
], { useHash: true }) | |
], |
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 { LazyComponent } from './lazy.component'; | |
import { LazyRoutingModule } from './lazy.routing'; | |
@NgModule({ | |
imports: [LazyRoutingModule], | |
declarations: [LazyComponent] | |
}) | |
export class LazyModule {} |
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
@NgModule({ | |
imports: [ BrowserModule ], | |
declarations: [ App, SafePipe ], | |
bootstrap: [ App ] | |
}) |
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
<iframe [src]="url | safe"></iframe> |
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 { Pipe, PipeTransform } from '@angular/core'; | |
import { DomSanitizer } from '@angular/platform-browser'; | |
@Pipe({ | |
name: 'safe' | |
}) | |
export class SafePipe implements PipeTransform { | |
constructor(private sanitizer: DomSanitizer) { } | |
transform(url) { |
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 {Component, NgModule, VERSION} from '@angular/core' | |
import {Http} from '@angular/http'// DON'T FORGOT TO IMPORT HTTP | |
import {BrowserModule} from '@angular/platform-browser' | |
import {HttpModule} from '@angular/http'; // DON'T FORGOT TO IMPORT HTTPMODULE | |
@Component({ | |
selector: 'my-app', | |
template: | |
`<div> | |
<h2>Response from server: {{greeting}}</h2> |