摘要: function getInfo(name:string,age?:number):string{ if(age){ return `${name} ${age}` }else{ return `${name} 年龄保密` } } 阅读全文
posted @ 2020-10-22 14:42 站在巨人的肩膀上1 阅读(241) 评论(0) 推荐(0)
摘要: 按快捷键ctrl+p可以弹出一个小窗,在上面的输入框输入文件名,下拉框点击一个文件 阅读全文
posted @ 2020-10-22 11:35 站在巨人的肩膀上1 阅读(1169) 评论(0) 推荐(0)
摘要: #重定向路由 :在用户访问一个特定的地址时,将其重定向到另一个指定的地址 // 路由重定向:下面的代码意思是:当访问一个空字符串的路径时,给重定向到home路由上 {path: '', redirectTo: '/home', pathMatch: 'full'}, 阅读全文
posted @ 2020-10-22 11:13 站在巨人的肩膀上1 阅读(275) 评论(0) 推荐(0)
摘要: angular创建一个默认带路由的项目 1.创建项目命令 ng new angualrdemo08 --skip-install 2.创建需要的组件 ng g component homeng g component newsng g component newscontent 3.找到app-ro 阅读全文
posted @ 2020-10-22 11:04 站在巨人的肩膀上1 阅读(95) 评论(0) 推荐(0)
摘要: Angular5.x 以后 get、post 和和服务器交互使用的是 HttpClientModule 模块。1、在 app.module.ts 中引入 HttpClientModule 并注入import {HttpClientModule} from '@angular/common/http' 阅读全文
posted @ 2020-10-21 17:29 站在巨人的肩膀上1 阅读(355) 评论(0) 推荐(0)
摘要: 生命周期函数通俗的讲就是组件创建、组件更新、组件销毁的时候会触发的一系列的方法。当 Angular 使用构造函数新建一个组件或指令后,就会按下面的顺序在特定时刻调用这些生命周期钩子方法。constructor 构造函数中除了使用简单的值对局部变量进行初始化之外,什么都不应该做。 (非生命周期函数)n 阅读全文
posted @ 2020-10-21 16:20 站在巨人的肩膀上1 阅读(310) 评论(0) 推荐(0)
摘要: 1.父组件调用子组件的时候传入数据 <app-header [msg]="massage"></app-header> 2.子组件引入input模块 import{Component,OnInit,Input}from'@angular /core'; 3.子组件@input接收父组件传过来的数据 阅读全文
posted @ 2020-10-21 15:55 站在巨人的肩膀上1 阅读(382) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-10-21 11:32 站在巨人的肩膀上1 阅读(205) 评论(0) 推荐(0)
摘要: 一、实现vs code中代码格式化快捷键:【Shift】+【Alt】+F 二、实现保存时自动代码格式化: 1)文件 .>【首选项】 >【设置】; 2)搜索emmet.include; 3)在settings.json下的【工作区设置】中添加以下语句: "editor.formatOnType": t 阅读全文
posted @ 2020-10-20 11:05 站在巨人的肩膀上1 阅读(5117) 评论(0) 推荐(0)
摘要: columns代表列 import { AppService, MessageType } from 'src/app/services/AppService';//先引入AppService,MessageType constructor(private appService: AppServic 阅读全文
posted @ 2020-10-20 11:01 站在巨人的肩膀上1 阅读(423) 评论(0) 推荐(0)