angular 输入属性
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-order',
templateUrl: './order.component.html',
styleUrls: ['./order.component.css']
})
export class OrderComponent implements OnInit {
@Input()
orderName: string;
@Input()
count: number;
constructor() { }
ngOnInit() {
setInterval(() => {
this.orderName = 'bbb';
}, );
}
}
<p>
买{{count}}手{{orderName}}产品
</p>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
orderName: string;
count: number;
}
<input [(ngModel)]='count'>
<input [(ngModel)]='orderName'>
<app-order [count]='count' [orderName]='orderName'></app-order>
angular 输入属性的更多相关文章
- angular 输入属性@Input , 输出属性@Output , 中间人模式
1 输入属性 通常用于父组件向子组件传递信息 举个栗子:我们在父组件向子组件传递股票代码,这里的子组件我们叫它app-order 首先在app.order.component.ts中声明需要由父组件传 ...
- angular的属性绑定
1. 图片地址属性绑定 html文件 <img [src]="imgUrl"> ts文件 export class ProductComponent implement ...
- Angular 6.X CLI(Angular.json) 属性详解
Angular CLI(Angular.json) 属性详解 简介 angular cli 是angular commond line interface的缩写,意为angular的命令行接口.在an ...
- angular常用属性大全
Angular元素属性大全 addClass()-为每个匹配的元素添加指定的样式类名 after()-在匹配元素集合中的每个元素后面插入参数所指定的内容,作为其兄弟节点 append()-在每个匹配元 ...
- Angular 输入中的禁止特定输入值--Validator 与 Directive 实现
1 前言 最近在项目中涉及表单的情况下,需要对用户输入进行过滤,比如填写用户名的时候不可以使用空格或者特殊符号,这里有几个解决方法: 使用 Angular 的正则同步验证器 使用 RxJS对输入的值进 ...
- 在checkbox中使用.prop; angular中属性的值使用变量问题
1.在checkbox中使用.prop而不使用.attr ,.attr有时并不如愿的改变checkbox的打钩问题 给这个checkbox设置return false就能阻止点击则改变状态的默认行为 ...
- EditText输入属性
1. android:inputType="none" android:inputType="text" android:inputType="tex ...
- angular 输出属性
import { Component, OnInit, EventEmitter, Output } from '@angular/core'; @Component({ selector: 'app ...
- angular 样式属性绑定
<button (click)="onClick($event)">点我</button> <input type="> <ta ...
随机推荐
- juc线程池原理(二):ThreadPoolExecutor的成员变量介绍
概要 线程池的实现类是ThreadPoolExecutor类.本章,我们通过分析ThreadPoolExecutor类,来了解线程池的原理. ThreadPoolExecutor数据结构 Thread ...
- mongdb与mysql的联系和区别
与关系型数据库相比,MongoDB的优点:①弱一致性(最终一致),更能保证用户的访问速度举例来说,在传统的关系型数据库中,一个COUNT类型的操作会锁定数据集,这样可以保证得到“当前”情况下的精确值. ...
- Node.js的原型继承函数util.inherits
util.inherits(constructor, superConstructor)是一个实现对象间原型继承 的函数.JavaScript 的面向对象特性是基于原型的,与常见的基于类的不同.Jav ...
- Python多线程-生产者消费者模型
用多线程和队列来实现生产者消费者模型 # -*- coding:utf-8 -*- __author__ = "MuT6 Sch01aR" import threading imp ...
- 清除stoped impdp/expdp job的方法
stoped impdp/expdp job会在dba_datapump_jobs中留下一条记录,显示为not running. 清除stopped job分两种情况: 1) job能够attach ...
- HALCON 算子函数(四) File
HALCON 算子函数——Chapter 4 : File 4.1 Images 1. read_image 功能:读取有不同文件格式的图像. 2. read_sequence 功能:读取图像. 3. ...
- 定时器Quartz ClassNotFound org.springframework.scheduling.quartz.SchedulerFactoryBean
转自:https://blog.csdn.net/truong/article/details/37508003 没有添加spring-context-support-3.2.4.RELEASE.ja ...
- 微信开发准备(四)--nat123内网地址公网映射实现
转自:http://www.cuiyongzhi.com/post/37.html 在前面几篇中我们一直说的开发准备工作主要是基于开发框架上的,这里我们说的就逐渐接近开发过程中的实体操作了,如果你之前 ...
- android 除法运算保留小数点
java保留两位小数问题: 方式一: 四舍五入 double f = 111231.5585; BigDecimal b = new BigDecimal(f); double f1 = b.setS ...
- ELK(Elasticsearch/Logstash/Kibana)安装时常见错误总结
问题一: [2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter: Java.lang ...