随笔分类 - angular9-bilibili-lyc
来自哔哩哔哩学习视频
摘要:服务可以理解为公共的方法,项目里面需要用到的公共方法都可以抽离为一个公共的方法使用 服务类的定义通常紧跟在 “@Injectable()” 装饰器之后,依赖不一定是服务 —— 它还可能是函数或值。也就是说函数或值不需要@Injectable()装饰器 创建service的指令 ng generate
阅读全文
摘要:1、常规安装 npm install -g @angular/cli 2、指定安装版本(例子是安装9x版本) sudo npm install -g @angular/cli@9 ps:不加sudo可能会报权限错误
阅读全文
摘要:基本用法 import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <button type="button" class="btn btn-primary" (click)="
阅读全文
摘要:绑定图片 import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <img src="../assets/images/madao.jpg" alt="madao" /> <i
阅读全文
摘要:基本用法 import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <h1>{{title}}</h1> <h2>My favorite hero is: {{myHero}}<
阅读全文
摘要:显示数据 ng的模版中,默认用双大括号{{}}绑定组件中的变量显示出来 import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: ` <h1>{{title}}</h1> <h2>M
阅读全文
摘要:什么是angular module(ngModule)? angular module就是一个普通的类,但是这个类,一旦被@NgModule所装饰,那这个类就可以被称为angular module @NgModule元数据 @NgModule 获取一个元数据对象,它会告诉 Angular 如何编译和
阅读全文

浙公网安备 33010602011771号