1 @Component({
2 selector: 'auction-home', 3 template: `
4 HTML or other markup is in-lined here
5 `
6 })
7 export default class HomeComponent {
8
9 // Application logic goes here
10 }
import {Component} from 'angular2/core';
import {Route,RouteConfig,RouterOutlet} from 'angular2/router';
import HomeComponent from '../home/home';
import NavbarComponent from '../navbar/navbar';
import FooterComponent from '../footer/footer';
import SearchComponent from '../search/search';
import ProductDetailComponent from "../product-detail/product-detail";
@Component({
selector: 'auction-application''/',component: HomeComponent,as: 'Home'},{path: '/products/:id',component: ProductDetailComponent,as: 'ProductDetail'}
])
export default class ApplicationComponent {}
export class ProductService {
products: Product[] = [];
getProducts(): Array<Product> {
The code to retrieve product into goes here
return products;
}
}
@Component{
...
}
export class HomeComponent {
products: Product[] = [];
constructor(productService: ProductService) {
this.products = productService.getProducts();
}
}