摘要: 一,父组件给子组件传值 1,父组件调用子组件的时候传入数据 <app-header [msg]="msg"></app-header> 2,子组件引入Input模块 import { Component, OnInit ,Input } from '@angular/core'; 3,子组件中@In 阅读全文
posted @ 2020-07-04 15:56 风子磊 阅读(500) 评论(0) 推荐(0) 编辑
摘要: 一,引入模块 import {FormsModule} from "@angular/forms"; 二,js中定义绑定数据 public user:any={ username:'', sex:'1', cityList:['北京','上海','深圳'], city:'北京', hobby:[ { 阅读全文
posted @ 2020-07-04 12:06 风子磊 阅读(861) 评论(0) 推荐(0) 编辑
摘要: 一,先来一张盗的图 以上就是大概目录结构,我们编写代码主要在app这个文件夹下 根模块简介app.module.ts 其中app.component.css,app.component.html,app.component.ts组成根组件,项目启动后就把根组件添加到index.html页面中,渲染到 阅读全文
posted @ 2020-07-04 08:52 风子磊 阅读(224) 评论(0) 推荐(0) 编辑