waylau / angular-enterprise-application-development-samples Goto Github PK
View Code? Open in Web Editor NEWAngular Enterprise Application Development Samples. 《Angular企业级应用开发实战》源码
Home Page: https://waylau.com/books/
Angular Enterprise Application Development Samples. 《Angular企业级应用开发实战》源码
Home Page: https://waylau.com/books/
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.9.3/win32-x64-72_binding.node":
HTTP error 404 Not Found
package.json
{
"name": "hello-world",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^7.0.4",
"@angular/common": "^7.0.4",
"@angular/compiler": "^7.0.4",
"@angular/core": "^7.0.4",
"@angular/forms": "^7.0.4",
"@angular/http": "^7.0.4",
"@angular/platform-browser": "^7.0.4",
"@angular/platform-browser-dynamic": "^7.0.4",
"@angular/router": "^7.0.4",
"core-js": "^2.5.4",
"rxjs": "^6.3.3",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.10.6",
"@angular/cli": "~7.0.6",
"@angular/compiler-cli": "^7.0.4",
"@angular/language-service": "^7.0.4",
"@types/jasmine": "~3.3.0",
"@types/jasminewd2": "~2.0.6",
"@types/node": "~10.12.10",
"codelyzer": "~4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.4",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.1",
"ts-node": "~7.0.1",
"tslint": "~5.11.0",
"typescript": "~3.1.6"
}
}
当时组件中不存在user属性,而是存在users。也不应该改users属性,而是添加selectedUser
`import { Component, OnInit } from '@angular/core';
import {User} from '../user';
import {USERS} from '../mock-users';
@component({
selector: 'app-users',
templateUrl: './users.component.html',
styleUrls: ['./users.component.css']
})
export class UsersComponent implements OnInit {
users = USERS;
selectedUser: User;
onSelect(user: User): void {
this.selectedUser = user;
}
constructor() { }
ngOnInit(): void {
}
}
`
在本地编译报错如下:
constant-scope.ts:5:1 - error TS2588: Cannot assign to 'x' because it is a constant.
5 x = 2; //错误
~
Found 1 error.
// 展示新闻详情数据
showNewsDetailData() {
this.route.queryParams.subscribe(p => this.newsUrl = p.newsUrl);// 获取参数
this.newsDetailService.getNewsData(this.newsUrl).subscribe(
(newsApiData) => this.newsDetailData =
this.domSanitizer.bypassSecurityTrustHtml(newsApiData.toString()) //HTML过滤
);
}
是否应该修改为:
showNewsDetailData() {
this.route.queryParams.subscribe(p => {
this.newsUrl = p.newsUrl;
this.newsDetailService.getNewsData(this.newsUrl).subscribe(
(newsApiData) => this.newsDetailData =
this.domSanitizer.bypassSecurityTrustHtml(newsApiData.toString()) //HTML过滤
);
}
);// 获取参数
因为 不能 保证 二个subscribe里面函数的执行顺序 ?
应为“修改 user-detail.component.ts 文件”
什么时候出第九版
封面设计建议带勒口,这样书角不容易折皱。
“75个”应为“74个”
“1.从路由参数中提取” 小节中。
原文“修改user.service.ts文件,在ngOnInit()生命周期钩子中调用getUsers(),代码如下:”
需要修改为:
“修改user-detail.component.ts文件,在ngOnInit()生命周期钩子中调用getUser(),代码如下:”
“component-interaction”应为“component-styles”
倒数第二行的“(3)0”应为“(3)”
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.