Previously we have tab-panel template defined like this: <ul class="tab-panel-buttons" *ngIf="tabs"> <li [ngClass]="{selected: tab.selected}" (click)="selectTab(tab)" *ngFor="let tab of tabs;">…
2018.9.7 问题描述: 通过ng serve命令启动angular应用时,卡在95%, ctrl+c 停掉后看到错误内容为找不到ng_modules下的angular模块下的package.json文件. --- 之前在网上下过小demo,依赖包都很旧了,因为时间久远, 但是一切正常可以运行.(使用 cnpm 来复原的包) --- 初学angualr,所有相关的东西,直接上手最新版, npm:6.4.1 ng v ng serve 出现错误停在95% \node_modules\_@ang…
Slicing 12345 L[:10:2] # [0, 2, 4, 6, 8]L[::5] # 所有数,每5个取一个# [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95] L[:] # copy L Iterating 12 for x, y in [(1, 1), (2, 4), (3, 9)]: print(x, y) List Comprehension A list compreh…
1. ng-template 形式:<ng-template>...</ng-template> 默认ng-template中的内容会隐藏; 可通过[ngIf]来控制内容显示隐藏: 此标签不会影响原本html结构: html: <ng-template [ngIf]="true"> this is template! </ng-template> 浏览器输出: 浏览器调试窗口 2. template 形式:<template>…
Here is the defulat tab header template: <ng-template #defaultTabHeader let-tabs="tabsX"> <ul class="tab-panel-buttons" *ngIf="tabs"> <li [ngClass]="{selected: tab.selected}" (click)="selectTab(t…
The structure directive is just a sugar syntax of <template>. Such as: <div *ngIf="name.length > 2"> This is something... </div> Equal to: <template [ngIf]="name.length > 2"> <div> There are somoethi…
Make sure install the latest Angular v6 with Angular CLI. Checkout ght Github for the code. 1. Create a new application: ng new elementApp 2. Install @angular/elements package: ng add @angular/elements --project-name=<your_project_name> 3. Generate…
angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(self,fn,args); self:object  对象: fn的上下文对象,在fn中可以用this调用 fn:function: 绑定的方法 args:传入fn的参数 使用代码: var obj = { name: "Any" }; var fn = function (Adj) { c…
angular.element 将DOM元素或者HTML字符串一包装成一个jQuery元素. 格式:angular.element(element); element:包装成jquery对象的html字符串或者dom元素 jqLite提供的方法: addClass() after() append() attr() bind() – 不支持命名空间,选择器和事件数据 children() – 不支持选择器 clone() contents() css() data() empty() eq()…
1. Installl latest @angular/cli: sudo npm i -g @angular/cli@next The version I used is:6.0.0-rc.10 2. Create a new application: ng new cdk-demo --routing 3. Install material and cdk packages: Here need to add @next, because by the time I tried the ap…