【发布时间】:2018-03-13 13:49:45
【问题描述】:
我有问题
我的 hello.component.html 是:
<form>
<input ng-model="hello" type="text">
</form>
<p>{{hello}}</p>
hello.component.ts 是:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-hellow',
templateUrl: './hellow.component.html',
styleUrls: ['./hellow.component.css']
})
export class HellowComponent implements OnInit {
hello:string ='';
constructor() { }
ngOnInit() {
}
}
你能回答吗
如果我在输入中写了一些东西,控制器不会实现 {{hello}} 字符串插值。
你能帮我解决这个问题吗?
也尝试过:
<input [(ngModel)]="hello" type="text">
非常感谢。
【问题讨论】:
-
检查您的控制台...
-
尝试在输入框和[(ngModel)]上设置name属性为“hello”
标签: angular string-interpolation