- 博客(27)
- 收藏
- 关注
原创 Fri Sep 28 2018 00:00:00 GMT+0800 (中国标准时间) {} 时间格式转换
Fri Sep 28 2018 00:00:00 GMT+0800 (中国标准时间) {} 转换为 2018-09-28 00:00:00parseTime(d: any) { const newDate = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' ...
2018-07-31 15:35:32
25142
转载 angular 中引入 easyUI
参照 easyUI 官网:http://www.jeasyui.com/documentation2/index.php之后报错:Error: Can't resolve 'rxjs/Subject' in 'F:\ecuador-demo\node_modules\ng-easyui\components\messager'解决办法: import{Subject}from...
2018-07-30 16:07:24
1710
原创 primeNG__datatable
使用注意:1. 单选多选表格, <p-table> 不可添加 dataKey="vin",否则选中样式为所有行;2. 表格宽度随内容适应,<p-table> 添加 autoLayout="true";3. 后台得到的数据需要映射,通过自定义管道实现,遍历数据找到该项;...
2018-07-26 08:40:13
1123
转载 please specify path to 'tslint' package correctly
解决办法:webstorm配置tslint参考:https://blog.youkuaiyun.com/zhumengzj/article/details/79041787
2018-07-06 09:34:38
2806
原创 ERROR in No NgModule metadata found for 'AppModule'.
解决办法:在AppModule中随便删除一行
2018-07-06 09:03:47
2212
原创 angular项目中用到的主要技术
平滑滚动条 MalihuScrollbarhttps://github.com/jfcere/ngx-malihu-scrollbar百度地图 Angular2-baidu-maphttps://leftstick.github.io/angular2-baidu-map/#/quickstart高德地图 ngx-amaphttps://xieziyu.github.io/ngx-amap/#...
2018-06-28 09:42:51
1189
原创 Could not find module "@angular-devkit/build-angular"
报错:Could not find module "@angular-devkit/build-angular"解决办法:npm i --save-dev @angular-devkit/build-angular
2018-06-25 17:27:46
11544
7
原创 通过调试工具 查找 登录提交的接口
通过调试工具 查找 登录提交的接口:输入错误的账户密码点击登录按钮F12 > network> all
2018-06-05 10:06:11
2553
1
原创 元数据版本不匹配 报错
报错:ERROR in Metadata version mismatch for module /node_modules/angular2-cool-storage/index.d.ts, found version 4, expected 3,原因: 暂时未知解决办法:在app.rouring.module.ts 随便打几个空格,重新编译即可参考:https://blog.youkuaiyun.com/...
2018-05-29 09:56:37
1864
原创 app模块引入BrowserAnimationsModule 报错
原因:没有安装@angular/animations模块解决办法:npm install @angular/animations@latest --save
2018-05-28 17:53:31
1172
原创 获取数据时过滤数据
1. 关键字传参:写法简单,但是获取不同的数据时,需要多次从服务器发出请求;2. 管道:需要自定义管道,判断是否包含该字段,返回包含该字段的数据,写着麻烦,但是之后调用方便,所以不同管道到底是取了一次数据还是多次?...
2018-05-07 11:42:21
1013
转载 公用组件
想要定义一个公共模块,然后模块里面有一堆公用组件,这些组件可以在任意其他模块使用,那么这种情况下,你定义的公共模块必须要导出( exports )你所有隶属于这个模块的公共组件,在其他模块使用的时候不用导入这些公共组件,只需要导入公共模块即可...
2018-04-27 13:36:37
1056
原创 Angular4中回调函数内数据绑定无法及时更新
解决办法:1. 导入 ChangeDetectorRef :import { ChangeDetectorRef } from '@angular/core'; constructor( private changeDetectorRef: ChangeDetectorRef) { }2. 回调函数内,获得数据后:this.changeDetectorRef.markForCheck();...
2018-04-27 09:33:00
1707
3
原创 TypeError: Cannot read property 'valid' of undefined
控制台报错:TypeError: Cannot read property 'valid' of undefined编辑器提示:解决办法:添加方法获取nameget name() { return this.heroForm.get('name');}
2018-04-25 11:07:33
1416
转载 Angular 报错
Can't bind to 'formGroup' since it isn't a known property of 'form'所在模块已经引入了 FormsModule ,ReactiveFormsModule 解决办法:在app.module.ts中引入FormsModule ,ReactiveFormsModule...
2018-04-24 14:38:15
316
原创 内存 Web API(In-memory Web API) 模拟多个远程数据
内存 Web API(In-memory Web API) 模拟多个远程数据时,app.module中1. 引入数据服务:import { ClientsDataService } from './clients-data.service';import { InMemoryDataService } from './org-data.service';2. imports:HttpClient...
2018-04-10 16:24:21
1550
1
原创 【bug】TypeError: undefined is not a function
控制台报错:TypeError: undefined is not a function可能是因为调用的函数未定义,但是都定义了解决办法:重新启动 ng serve 即可
2018-04-10 10:44:05
1227
原创 【坑】新建组件报错
F:\samples>ng g c add-sampleError: More than one module matches. Use skip-import option to skip importing the component into the closest module.More than one module matches. Use skip-import option ...
2018-04-02 16:21:12
3739
原创 【Angular】路由router
1. 新建路由模块ng generate module app-routing --flat --module=app--flat 生成在src/app--module=app 配置到app模块2. 引入所需组件import { HeroesComponent } from './heroes/heroes.component';import { ...
2018-04-02 11:58:11
403
原创 【Angular】组件之间通讯 Input & Output
Input 【 父组件向子组件传入数据 】父组件:1. 准备数据(或引入服务中获取数据)import { Hero } from '../hero'; // 定义类型import { HEROES } from '../mock-hero'; // json数据heroes = HEROE...
2018-04-02 10:31:28
259
原创 【Angular】服务 Service
一. 创建服务1. 新建服务 ng generate service ... --module=app //创建该服务并注入配置到app.module2. 设置该服务的方法eg: debug(msg: string){ console.log(msg); }二. 组件使用该服务1. 引入服务import { LoggerService } from '....
2018-03-29 09:08:20
778
原创 【坑】angular官方教程Http获取不到数据
安装的最新版本为0.6.0 , 一直获取不到数据;解决办法:安装版本为0.5.0npm install angular-in-memory-web-api@0.5.0--------------------------------------------------------------------------------------http.get请求后台数据 , npm运行成功 ,但是并没有...
2018-03-28 15:34:21
1318
转载 【Angular】MVVM设计模式
MVVM(Model-View-ViewModel)MVVM框架是MVP模式与WPF结合的一种新型架构框架。MVC & MVP相似点:Controller/Presenter负责逻辑的处理,Model提供数 据,View负责显示。二者区别:MVC:View直接从Model中读取数据。MVP:View不直接使用Model,通过 Presenter (MVC中的Controller)来进行交...
2018-03-28 13:56:36
659
原创 【Angular】数据绑定的方法
1. 插值{{ greeting }} greeting = " " ;2. 属性绑定[ value ] = " string / 表达式 "3. 事件绑定(click)= " myclick( ) "4. 双向绑定[( ngModel )] = " myData "即 属性绑定 +事件绑定,记住 ' 盒子里的香蕉 ';双向数据绑定是MVVM设计模式中的显著特征;...
2018-03-28 13:51:00
255
原创 【坑】使用 RxJS 的 of() 函数来模拟从服务器返回数据
服务中引入 RxJS:import { Observable, of } from 'rxjs';//官方文档中的写法 出现报错 /heroes/node_modules/rxjs/Rx"' has no exported member 'of'.解决办法:import { Observable } from 'rxjs/Observable';import { of } from 'rxjs/o...
2018-03-28 12:03:55
1896
原创 【Angular】angular CLI 命令
angular CLI 命令:ng new 项目名ng generate component 组件名( 默认情况下,生成的组件会带有模板文件,你可以通过参数覆盖它:ng generate component 组件名 -it)ng generate class hero 【 hero.ts 】ng generate service 服务名ng generate module 路由模块名 --fla...
2018-03-28 11:55:14
270
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人