ElementRef、Renderer
segmentfault.com/a/119000000…
import * as xxx from 'xxx'
import * as xxx from 'xxx' 会将 "xxx" 中所有 export 导出的内容组合成一个对象返回(或import * as obj from 'xx' 这种写法是把所有的输出包裹到obj对象里);
eg:
xxx里中:
export function test(){
return '返回是test 内容';
}
export function login(){
return '返回login 内容';
}
调用test 函数,即obj.test();
调用login 函数,即obj.login();
visibilitychange
浏览器标签页被隐藏或显示的时候会触发visibilitychange事件
https://www.jianshu.com/p/e905584f8ed2
swiper
#js
this.swiper = new Swiper(this.element.querySelector('.swiper'), {
onSlideChangeEnd: ({ activeIndex }) => {
this.activeIndex = activeIndex;
},
autoplay:true,
}});
#html
<div class="swiper">
<div class=" swiper-wrapper">
<div class="swiper-slide"
*ngFor="let thumbnail of model?.thumbnails">
<img [src]="thumbnail">
</div>
</div>
<div class="swiper-pagination abs" fs="10">
{{activeIndex + 1}}/{{model?.thumbnails.length}}
</div>
<div class="product-page-save-new" *ngIf="model&&model.brand&&!errorRequest" (click)="downloadPics()" >
<i class=" material-icon product-page-save-icon">file_download</i>
</div>
</div>
Location
angular 中location服务负责和浏览器的url打交道, 比如规格化url、前进、后退、拼接url等