【发布时间】:2017-10-11 02:56:11
【问题描述】:
我有一个输入,我在其中使用 2 路绑定语法来填充它的值,就像在一个单独的组件中一样:
<input type="text" [(ngModel)]="this.inputValue" id="itemText">
在我的 index.html 中,我设置了 inputValue 的值:
onSelect: function (request, response) {
this.inputValue = request.item;
}
但是,我的输入正在使用这个新值进行更新,我缺少什么?
编辑: 组件设置如下:
@Component({
selector: 'app-leftpane-table',
templateUrl: './leftpane-table.component.html'
})
export class LeftpaneTableComponent implements OnInit {
inputValue:any;
constructor(private ds: DataService) { }
ngOnInit() {}
在 index.html 中,一旦从搜索结果中选择了一个项目,我就会设置 inputValue:
$('.ui.search')
.search({
apiSettings: {
url: 'http://localhost:8088/Badges/{query}'
},
onSelect: function (request, response) {
var urlApi = 'http://localhost:8088/Badges/Details/' + request.item;
this.inputValue = request.item;
}
});
【问题讨论】:
标签: angular model-binding