angular demo1
来源:互联网 发布:淘宝助手上传宝贝教程 编辑:程序博客网 时间:2024/06/05 05:42
ng generate component article 生成一个新组件
此命令 新建一个atricle文件夹(里面包含组件需要的文件)
此外 还在app.module.ts 文件中引入acticleComponent 组件 并声明 acticleComponentimport { BrowserModule } from '@angular/platform-browser';import { NgModule } from '@angular/core';import { AppComponent } from './app.component';import { ArticleComponent } from './article/article.component'; //引入组件@NgModule({ declarations: [ AppComponent, ArticleComponent //声明组件 ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent]})export class AppModule { }
想要完整构建一个组件 构建一个model文件
article.model.ts 里面写class对象
export class Article { //属性类型 title:string; link:string; votes:number; constructor(title:string,link:string,votes?:number){ //默认的属性 this.title = title; this.link = link; this.votes = votes || 0; }}
阅读全文
0 0
- angular demo1
- demo1
- demo1
- demo1
- demo1
- webservice demo1
- libgdx demo1
- SNMP Demo1
- 线程demo1
- bash demo1
- OpenglES Demo1
- Grape-demo1
- socket demo1
- angularJs Demo1
- django-demo1
- LeapMotion Demo1
- java--Demo1
- Angular
- 关于页面跳转的一些总结 浏览器对象与页面刷新 -- JAVA web
- 解决 error C1083: 无法打开预编译头文件xxx.pch: No such file or directory
- 区间价值?hihocoder1483《二分!!+尺取法》
- Unity克隆游戏对象
- CART之回归树构建
- angular demo1
- 使用opencv2查看图片彩色直方图
- hdu1203 I NEED A OFFER!(01背包)
- The Super Powers
- vue项目搭建(vue-cli)以及其他配置
- HDU 5978 && 2016ICPC大连 H: To begin or not to begin
- iOS尝试用测试驱动的方法开发一个列表模块【四】
- [模板] 二叉堆
- [笔记分享] [Hardware] PM8058 User Guide study report