zoukankan      html  css  js  c++  java
  • Angular

    1. git clone

    git clone https://github.com/angular/quickstart ng4-quickstart

    2. 双向绑定:

    前端:<input type="text" ng-model="name"> <h1>Hello {{name}} {{address.city}}</h1>

    后端:export class AppComponent {name = 'Hello'; address = {province: '江苏', city: '苏州'}} //address是对象

    利用Angular内置json管道显示对象信息:<p>{{address | json}}</p>

    3. 表单

    <form (submit)="addSkill(skill.value)">

      <label>添加剂能</label>

      <input type="text" #skill>

    </form>

    4. 事件绑定

    <button (click)="toggleSkills()">

      {{showSkill ? "隐藏技能" : "显示技能"}}

    </button>

    toggleSkills() {this.showSkill = !this.showSkill;}

    5. *ngIf *ngFor

    <div *ngIf = "members">

      <li *ngFor = "let member of members;" >

      </li>

    </div>

    6. HTTP

    this.http.get('https://api.github.com...')

      .map(res => res.json())

      .subscribe(data => {

        if(data) this.members = data;

      });

    7. 注入

    export class MemberService{

      getMembers(){

        return this.http.get('https://api...').map(res => res.json())

      }

    }

    this.memberservice.getMembers()

      .subscribe(data => {

        if(data) this.members = data;

      });

  • 相关阅读:
    jvm字节码简介
    Class类文件结构
    springboot 配置webservice接口
    jdk(1.8)命令行工具(二)
    springboot集成JsonRpc2.0
    jdk命令行工具(一)
    linux安装spark-2.3.0集群
    linux安装scala环境
    [机器学习实践] 针对Breast-Cancer数据集
    mac下 selenium + python 配置和入门
  • 原文地址:https://www.cnblogs.com/embeddedking/p/9886383.html
Copyright © 2011-2022 走看看