
angular
优秀的金大大
这个作者很懒,什么都没留下…
展开
-
angular命令、 装饰器、 生命周期简介
1.命令ng newprojectName--style=scss //创建scss的项目npm install yarn -g 创建yarn环境 (用yarn代替npm)yarn install (按照package.json安装依赖包)ng serve -o(运行并打开)ng g ccomponentName创建组件ng g mmoduleName...原创 2019-06-09 12:07:18 · 213 阅读 · 0 评论 -
更新本地 angular开发环境
npm uninstall -g angular-clinpm uninstall -g @angular/clinpm cache clean --forceDelete the C:\Users\YOU\AppData\Roaming\npm\node_modules\@angular folder.然后用 ng -v 检查npm install -g @angula...原创 2019-06-09 12:44:54 · 766 阅读 · 0 评论 -
angular 强制刷新视图
使用angular的过程中有时会出现数据已经更新了,但是对于的视图没有更新,针对这一情况,可以是用angular提供的方法强制更新视图。import { Component, OnInit } from '@angular/core';import {NgZone} from '@angular/core'@Component({ selector: 'app-showmain'...原创 2019-06-09 13:29:23 · 7200 阅读 · 0 评论 -
解决使用angular2路由后,页面刷新后报404错误。
点击路由链接跳转页面是正常的,但是当刷新页面时就出现了404错误。解决方法如下:在app.module.ts中添加import:import {HashLocationStrategy,LocationStrategy} from '@angular/common';并在 providers下添加所引入的服务:providers: [{provide: LocationStr...原创 2019-06-09 13:38:02 · 1044 阅读 · 0 评论 -
angular父子组件通信 ,一个模块使用另一个模块的组件
父组件1.parent.component.html<div class="parentBox"> <p> parent works! </p> <!--[]传参 ()传递方法 --> <app-child #child [fromParent]="parent" (notify)="onNotify($...原创 2019-06-09 15:58:52 · 3960 阅读 · 1 评论 -
Angular Http、Jsonp、rxjs请求
Http请求依赖注入import { HttpModule} from “@angular/http”;页面引入Httpimport { Http} from “@angular/http”;constructor(private http:Http){ }get请求this.http.get(url).subscribe(function(data){console.log(...原创 2019-06-09 16:31:03 · 331 阅读 · 0 评论