
angular
litter_lj
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Angular基础小知识
1.angular的脚手架的安装 npm(cnpm) i @angular/cli -g //安装脚手架 ng new 项目名 //创建项目(默认会进行npm install) ng new 项目名 --skip-install //创建项目但是不安装依赖 2.ng添加组件,默认根目录是在app目录下 ng g component (组建的目录...原创 2019-03-23 17:02:25 · 201 阅读 · 0 评论 -
Angular 获取dom方法
1.通过原生的js获取(在ngAfterViewInit的生命周期里面获取,类似vue的mounted) 2.通过ViewChild装饰器获取 import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core'; //引入 ViewChild, ElementRef (表示d...原创 2019-04-05 15:35:27 · 6140 阅读 · 0 评论 -
angular的生命周期
1.ngOnChanges() 父组件传值或者父组件传入的值进行更新时候触发的生命周期 2.ngOnInit (重要) 初始化指令,组件,在ngOnChanges()后面调用,只调用一次 一般用于接口数据请求 3.ngDoCheck 变更检测周期中调用,就是当对数据改变之后进行不同的操作的时候有用 4.ngAfterContentInit 内容投影到组件后调用,只调用一次 5.n...原创 2019-04-05 17:21:20 · 768 阅读 · 0 评论 -
angular HttpClient请求接口数据
1.在app.module.ts引入模块 import { HttpClientModule, HttpClientJsonpModule} from '@angular/common/http'; //引入 HttpClientModule, 如果需要用jsonp,就引入HttpClientJsonpModule @NgModule({ declarations: [ App...原创 2019-04-05 17:35:38 · 1810 阅读 · 0 评论 -
angular的路由
1.路由引入 import { AppRoutingModule } from './app-routing.module'; //app.module引入router的文件 @NgModule({ declarations: [ AppComponent, HeaderComponent, DetailComponent, DetailQueryCo...原创 2019-04-05 20:50:32 · 203 阅读 · 0 评论 -
angular的自定义模块以及路由懒加载
1. 创建自定义模块 ng g module module/user --routing // 定义自定义模块指令,会创建user.module.ts(模块文件) 和 user-routing.module.ts(模块路由) // --routing表示需要路由,如果不需要就去掉 ----------------------- user.module.ts ------------...原创 2019-04-06 21:05:43 · 2590 阅读 · 0 评论