Code Monkey home page Code Monkey logo

book's People

Contributors

asnowwolf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

book's Issues

第十章第一个示例的chat安装依赖报错

10.2 聊天应用概览的示例

报错提示

If you continue to have issues, please report this full log at https://github.com/Medium/phantomjs
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxx/.npm/_logs/2020-05-29T07_13_01_850Z-debug.log

npm/yarn/开代理/无代理都尝试过 还是有问题

字符串模板不起作用

`import { Component,
OnInit,
Input } from '@angular/core';

@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
addArticle(title:HTMLInputElement,link:HTMLInputElement):boolean{
console.log('文章标题:${title.value} 链接 : ${link.value}');
return false;
}
}
`

其中:${title.value} 一直不起作用,而我用字符串拼接的方式则可以,百度不得解,不知少安装了什么
初次学习,请大家指导

第3章,组件的输入代码错误

位置:3.5.2 组件的输入
错误内容:在讲解组件中inputs配置项时,实例属性名和标签元素属性名写反了。
文中提到:然而,如果我们希望组件实例属性enabled在组件标签中对应的标签元素属性名称为isEnabled,就可以使用上面提到的这个语法:
@component({
//...
inputs: [
'name: name',
'age: age',
'isEnabled: enabled'
]
//...
})
class MyComponent {
name: string;
age: number;
isEnabled: boolean;
}
进一步说,由于只有一个属性需要明确指定从enabled映射到isEnabled,我们可以继续简化:
@Compoent({
//...
inputs: ['name', 'age', 'isEnabled: enabled']
//...
})
class MyComponent {
name: string;
age: number;
isEnabled: boolean;
}
以上两端代码中的'isEnabled: enabled',均与”我们希望组件实例属性enabled在组件标签中对应的标签元素属性名称为isEnabled“要求不符,应该写成'enabled: isEnabled'。
请雪狼团队审查原书并纠正错误,谢谢!

为组件定义的类没有引入的问题

在书本的第36页,1.9 渲染多行
在此章节创建了一个Article类,在第39页中修改Article组件代码中,并未使用import{}from 来引入类,读者学习使用中注意不到这一点,会导致页面报错,而毫无头绪,希望能加以修正。

第一章节:1.9使用数据模型,article.component初始化加载异常

在1.9小节-88页,书中直接在constructor中初始化this.article,导致在加载页面的时候,this.article找不到,undefined,页面展示异常
应该把初始化操作this.article赋值操作放于ngOnInit中操作,constructor意为在类生成实例时调用,适用于依赖注入,所注入的可作为类的属性来使用。而ngOnInit则是angular规定的初始化操作的地方。

code/first_app/angular2_reddit/src/app/article/article.component.ts
export class ArticleComponent implements OnInit {
article: Article;
constructor() {
this.article = new Article(
'Angular',
'http://angular.io',
10);
}
voteUp(): boolean {
this.article.voteUp();
return false;
}
voteDown(): boolean {
this.article.voteDown();
return false;
}
ngOnInit() {
}
}

第10章 第225页 正文 第3行 翻译

根据上下文和内容 ”你可以点击会话(thread)和一个机器人聊天” 改为 你可以点击会话(thread)和另一个人聊天 会比较合适

第五章 5.4 使用FormBuilder

第一句话 原话为 “使用ngForm和ngControl隐式构建FormControl和FormGroup确实很方便,但无法为我们提供
更多定制化选项。”
而在5.4之前的章节中没有提到ngControl,而根据之前的例子实验,这句话应修改为
“ 使用ngForm和ngModel隐式构建FormControl和FormGroup确实很方便,但无法为我们提供
更多定制化选项。”

第三章 3.7 产品图片组件

<img src="{{ product.imageUrl }}"
这种写法也可以正常加载图片,{{ product.imageUrl }}并未被解析为字符串

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.