
Angular
文章平均质量分 55
kenadc
真正的大师,永远都怀着一颗学徒的心 ——易
剑圣在剑术方面已经是登峰造极,是当之无愧的大师,但他依然保留着一颗学徒的心。三人行,必有我师焉,人生就是一个不断学习的过程,学无止境,不管什么时候都有值得我们去学习的东西。
展开
-
Angular-父子路由(嵌套路由),类似html的iframe
1.创建组件引入组件import { HomeComponent } from './conponent/home/home.component';import { WelcomeComponent } from './conponent/welcome/welcome.component';import { SettingComponent } from './conponent/setting/setting.component';import { ProductComponent } fr原创 2021-04-11 17:25:31 · 424 阅读 · 0 评论 -
Angular-路由跳转传值 动态路由传值 js跳转传值
1.新建一个组件ng generate component routeCompinentChuanZhi2.app-routing.module.ts中配置路由import { RouteComponentChuanZhiComponent } from './conponent/route-component-chuan-zhi/route-component-chuan-zhi.component';const routes: Routes = [ {path:'rc1',comp原创 2021-04-11 16:24:31 · 369 阅读 · 0 评论 -
Angular-路由概述 配置路由 路由重定向 路由选中
路由就是根据不同的url地址,动态让根组件挂载其他组件来实现一个单页面应用1.把app.modeule.ts文件中创建组件时自动引入的组件复制到app-routing.module.ts中如下:app.module.tsimport { NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { AppRoutingModule } from '.原创 2021-04-11 15:21:50 · 320 阅读 · 0 评论 -
Angular-请求数据
Get:1.在app.module.ts中引入HttpClientModule并注入import{HttpClientModule} from '@angular/common/http';imports:[HttpClientModule, BrowserModule]2.在用到的地方引入HttpClient并在构造函数声明import{HttpClient} form '@angular/common/http';constructor(public http:HttpC原创 2021-04-11 13:39:45 · 436 阅读 · 0 评论 -
Angular-父组件与子组件使用
父组件给子组件传值/方法/整个父组件1.父组件调用子组件时传入数据<app-header [msg]="msg" [func]="test1" [allConponent]="this"></app-header>2.子组件引入Input模块import { Component, OnInit,Input} from '@angular/core';3.子组件中@Input接收父组件过来的数据@Input() msg:any;@Input() func原创 2021-04-11 13:24:22 · 811 阅读 · 0 评论 -
Angular-创建组件并使使用
1.创建组件: ng generate component componentName2.使用组件: 根组件直接使用:@Component({ selector: 'app-home>', templateUrl: './header.component.html', styleUrls: ['./header.component.css']})直接标签使用即可: <app-home></app-home>...原创 2021-04-11 13:04:58 · 205 阅读 · 0 评论 -
Angular-开发环境搭建
nodejs下载地址:https://nodejs.org/zh-cn/download/Angular官网地址:https://angular.cn/tutorial/toh-pt31.百度nodejs官网下载安装,一路next即可2.检验nodejs安装是否成功cmd执行命令: node -v npm -v3.npm安装angularcmd执行命令: npm install -g @angular/cli4.创建新项目: 在磁盘新建一个文件及为...原创 2021-04-11 13:02:15 · 227 阅读 · 0 评论