Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
angular 2 文档 规范 笔记 code 代码片段 – 扎老铁
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215

Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
Warning: mysqli_num_fields() expects parameter 1 to be mysqli_result, boolean given in /www/wwwroot/dev.zhalaotie.com/wp-includes/wp-db.php on line 3215
class="post-51905 post type-post status-publish format-standard hentry">

angular 2 文档 规范 笔记 code 代码片段

angular2

Angular 2 Training

https://angular-2-training-book.rangle.io/handout/routing/query_params.html

https://angular-2-training-book.rangle.io/handout/routing/route_guards.html

#项目安装

npm i

npm install -g @angular/cli 

npm install --save @angular/material

#项目运行

ng serve

material 控件库 material control

https://material.angular.io/components/component/select

view ajax son structure

typescript just a typeStructure , 即只是增加了智能提示

传递参数

Passing Query Parameters

Use the [queryParams] directive along with [routerLink] to pass query parameters. For example:

<a [routerLink]="['product-list']" [queryParams]="{ page: 99 }">Go to Page 99</a>

Alternatively, we can navigate programmatically using the Router service:

  goToPage(pageNum) {
    this.router.navigate(['/product-list'], { queryParams: { page: pageNum } });
  }

The routerLinkActive directive

The Angular Router provides a routerLinkActive directive we can use to add a class to the HTML navigation element whose route matches the active route. All we have to do is define the style for it. Sweet!

HTML CODE

  <h1>{{title}}</h1>

  <nav>

    <a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
    <a routerLink="/heroes" routerLinkActive="active">Heroes</a>

  </nav>

<router-outlet></router-outlet>

Parameterized route

We can add the hero’s id to the URL. When routing to the hero whose id is 11, we could expect to see a URL such as this:

/detail/11

The /detail/ part of that URL is constant. The trailing numeric id part changes from hero to hero. We need to represent that variable part of the route with a parameter (or token) that stands for the hero’s id.

Configure a Route with a Parameter

Here’s the route definition we’ll use.

CODE

{

  path: 'detail/:id',
  component: HeroDetailComponent
},

The colon (:) in the path indicates that :id is a placeholder to be filled with a specific hero id when navigating to the HeroDetailComponent.

获取参数

http://localhost:4200/iot/device/create?test=111xx

this.navParams.get("id")

console.log("navParams",this.navParams.get("id"));

styleUrls: [‘style.scss’],

Angular 2 Component Route config

import component

What is the difference between formControlName and FormControl?

http://stackoverflow.com/questions/40171914/what-is-the-difference-between-formcontrolname-and-formcontrol/40172009

error / exception

Angular 2 component and modules

http://bgz.bitshine.com.cn/Modules/Bitlab.Xensed/HtmlNoteFileSystem.Anonymous/Index#!/note/detail/100000001220160929163217103

https://angular.cn/docs/ts/latest/guide/lifecycle-hooks.html#!#aftercontent


https://github.com/kittencup/angular2-ama-cn/issues/56
接口 OnInit OnDestroy DoCheck OnChanges AfterContentInit AfterContentChecked AfterViewInit AfterViewChecked函数名 ngOnChanges – 当输入/输出绑定的值改变时调用 ngOnInit – 在第一次 ngOnChanges 后调用 ngDoCheck – 自定义的方法,检测和处理值的改变 ngAfterContentInit – 在组件内容初始化之后调用 ngAfterContentChecked – 组件每次检查内容时调用 ngAfterViewInit – 组件相应的视图初始化之后调用 ngAfterViewChecked – 组件每次检查视图时调用 ngOnDestroy – 指令销毁前调用。

发表评论

电子邮件地址不会被公开。