angularjs2 四
来源:互联网 发布:淘宝出售的宝贝消失了 编辑:程序博客网 时间:2024/04/29 23:34
import {Component} from 'angular2/core';import {HeroDetailComponent} from './hero-detail';import {Hero} from './hero';import {HeroService} from './hero-service';@Component({ selector: 'appTest', template: ` <h4 >下面是providers内容</h4> <ul> <li *ngFor="#hero of heroes"><span>{{hero.id}}</span>{{hero.name}}</li> </ul> `, providers: [HeroService]})export class App { constructor(private _heroService: HeroService) { } public heroes = this._heroService.getHeroes();}
/** * Created by dell on 2016/9/8. */import {Injectable} from 'angular2/core';import {HEROES} from './mock-heroes';@Injectable()export class HeroService { getHeroes() { return HEROES; }}
/** * Created by dell on 2016/9/8. */import {Hero} from './hero';export var HEROES: Hero[] = [ { "id": 11, "name": "苹果手机" }, { "id": 12, "name": "亚马逊" }, { "id": 13, "name": "谷歌" }, { "id": 14, "name": "Facebook" }, { "id": 15, "name": "雅虎" }, { "id": 16, "name": "阿里巴巴" }, { "id": 17, "name": "淘宝网" }, { "id": 18, "name": "京东" }, { "id": 19, "name": "小米" }, { "id": 20, "name": "腾讯" }];
/** * Created by dell on 2016/9/8. */export interface Hero { id: number; name: string;}
0 0
- angularjs2 四
- AngularJS2
- Angularjs2
- angularjs2
- 跟着angularjs2官方文档学习(四)
- angularjs2 一
- angularjs2 二
- angularjs2 三
- angularjs2 五
- angularjs2 六
- angularjs2 七
- angularjs2 八
- angularjs2 九
- angularjs2 十
- angularjs2 指令
- angularjs2 表单
- AngularJS2 架构
- AngularJS2 表单
- 【Qt开发】QSplitter的使用和设置
- Filter中获取Spring的bean
- Https证书制作方法
- FacePlusPlus人脸识别
- 圆背景组件以及数字红点
- angularjs2 四
- 项目1-c/c++语言中函数参数传递的三中方式
- 共同父域下的单点登录
- 十条jQuery代码片段助力Web开发效率提升
- 深入理解RunLoop
- 复习 类和对象
- Hi3516A开发--USB PCB 设计建议
- 图像分割(一)--综述
- 第二周项目3--体验复杂度1--两种排序算法的运行时间