gpt4 book ai didi

angular - Ionic 2 和 ng-model

转载 作者:太空狗 更新时间:2023-10-29 17:24:54 25 4
gpt4 key购买 nike

我真的觉得自己是一个早期采用者,因为 Google 找不到解决我问题的方法:)

我以某种方式收到此错误:

Can't bind to 'ng-model' since it isn't a known native property

我在Ionic中没有看到@Component,所以页面是这样配置的:

import {Page, NavController} from 'ionic-framework/ionic';
@Page({
templateUrl: 'app/home/home.html',
directives: [Select]
})

我的模板是这样的:

<ion-input floating-label>
<ion-label>Search text...</ion-label>
<input type="text" [(ng-model)]="searchInput" />
</ion-input>

我正在使用 Ionic 2。

干杯

最佳答案

在 Angular 2 中,你应该使用 ngModel在模板中,而不是 ng-model

关于angular - Ionic 2 和 ng-model,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34478287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com