October 2017
Intermediate to advanced
280 pages
6h 50m
English
Now, let's suppose we want to add a timer to our page and reuse a web component that we have already built. In this case, our application can look something like this:
// ch5/custom-element/app.ts
import {Component, NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
@Component({
selector: 'my-app',
template: `
<h1>Hello {{name}}</h1>
The current timeout is <simple-timer></simple-timer>
`
})
class App {
name: string = 'John Doe';
}
@NgModule({
imports: [BrowserModule],
declarations: [App],
bootstrap: [App]
})
class AppModule {}
platformBrowserDynamic().bootstrapModule(AppModule);
Now, if we run our ...
Read now
Unlock full access