March 2017
Intermediate to advanced
821 pages
18h 21m
English
Let's create HomeComponent, SearchResultComponent, and NotFoundComponent. Before that, let's create a component to display the search form. The search form will have a textbox and a search button. Follow these steps:
index.js file, above the AppComponent code:var FormComponent = ng.core.Component({
selector: "search-form",
directives: [ng.router.ROUTER_DIRECTIVES],
templateUrl: "componentTemplates/search-form.html",
}).Class({
constructor: function(){},
ngOnInit: function(){
this.searchParams = {
query: ""
};
this.keyup = function(e){
this.searchParams = {
query: e.srcElement.value
};
};
}
})search-form.html in the componentTemplates directory, and place this code in it: ...Read now
Unlock full access