文档资料

  • 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions
  • 箭头函数--ES6文档:http://es6.ruanyifeng.com/#docs/function#箭头函数

  • Promise 对象--JS教程:https://wangdoc.com/javascript/async/promise.html
  • Promise--ES6文档:http://es6.ruanyifeng.com/#docs/promise
  • Promise--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise
  • Promise.prototype.then()--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/then

  • 教程:英雄指南:https://www.angular.cn/tutorial#tutorial-tour-of-heroes
  • 工作区与项目文件的结构:https://www.angular.cn/guide/file-structure
  • 组件简介:https://www.angular.cn/guide/architecture-components
  • CLI 命令参考手册:https://www.angular.cn/cli

服务

服务:https://www.angular.cn/tutorial/toh-pt4#services

英雄指南的 HeroesComponent 目前获取和显示的都是模拟数据。

本节课的重构完成之后,HeroesComponent 变得更精简,并且聚焦于为它的视图提供支持。这也让它更容易使用模拟服务进行单元测试。

为什么需要服务

创建 HeroService

@Injectable() 服务

获取英雄数据

提供(provide) HeroService

修改 HeroesComponent

注入 HeroService

添加 getHeroes()

在 ngOnInit 中调用它

可观察(Observable)的数据

可观察对象版本的 HeroService

在 HeroesComponent 中订阅

显示消息

创建 MessagesComponent

创建 MessageService

把它注入到 HeroService 中

从 HeroService 中发送一条消息

从 HeroService 中显示消息

绑定到 MessageService

查看最终代码

Angular记录(7)的更多相关文章

  1. Angular记录(2)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  2. Angular记录(11)

    开始使用Angular写页面 使用WebStorm:版本2018.3.5 官网资料 资料大部分有中文翻译,很不错 速查表:https://www.angular.cn/guide/cheatsheet ...

  3. Angular记录(10)

    文档资料 速查表:https://www.angular.cn/guide/cheatsheet 风格指南:https://www.angular.cn/guide/styleguide Angula ...

  4. Angular记录(9)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  5. Angular记录(8)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  6. Angular记录(6)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  7. Angular记录(5)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  8. Angular记录(4)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  9. Angular记录(3)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

随机推荐

  1. cvc-elt.1: Cannot find the declaration of element 'beans'Failed to read schema document 'http://www.springframework.org/schema/beans/spring- beans-3.0.xsd'

    Multiple annotations found at this line: - cvc-elt.1: Cannot find the declaration of element 'beans' ...

  2. 十款 Chrome 扩展工具,提高前端编码效率

    1. 掘金 Chrome 插件 对于开发者来说,比开发过程更重要的,应该要算平时对于开发资源以及技术文章一点一滴的积累了吧.那么,开发者能够在哪里获取需要的技术内容呢?过去,你可能需要在 GitHub ...

  3. Android串口开发

    参考资料: https://www.jianshu.com/p/9249ed03e745 GitHUb地址: https://github.com/AIlll/AndroidSerialPort An ...

  4. java倒计时三种简单实现方式

    写完js倒计时,突然想用java实现倒计时,写了三种实现方式 一:设置时长的倒计时: 二:设置时间戳的倒计时: 三:使用java.util.Timer类实现的时间戳倒计时 代码如下: package ...

  5. windows下mysql 5.7以上版本安装及遇到的问题

    (原) 早些前用window安装mysql挺简单的,一个安装程序,一路下一步. 2006的5.0版本,确实太早了点. 于是官网上又下了一个版本,windows也是提供了二个版本Installer(安装 ...

  6. Django 使用mysql 创建项目

    一.安装 mysql 和 mysqlclient 1. 安装 mysql ,https://www.jianshu.com/p/07a9826898c0 2. pip3 install mysqlcl ...

  7. CF396C On Changing Tree

    CF396C On Changing Tree 给定一棵以 \(1\) 为根的树,初始时所有点权为 \(0\) 有 \(m\) 次操作,分为两种 \(1\ u\ x\ k\) 表示给以 \(u\) 的 ...

  8. PHP按权重随机

    之前业务部门提了一个需求,要求将广告按照ecpm高低进行随机.(即:ecpm高的获取流量的几率大) 如下数组: //要求AD1的概率要求为50%,AD2概率为25% ,AD3的概率为15%,AD4的概 ...

  9. easyUI的常见属性

    datagrid (数据表格) $("#tg").datagrid({url:"TaskList",//请求的地址fit: false, //当true时设置他 ...

  10. iview 将table的selection多选变单选方法

    相信很多使用iview的朋友,在用到table,都会遇到需要使用selection的场景,但是总会有那么一个产品汪,觉得iview的单选效果不好,非要用selection的来做单选,那么下面这个方法就 ...