离子2和ng-模型

ata*_*adi 6 angular-ngmodel ionic2 angular

我真的觉得它是一个早期采用者,因为谷歌无法找到解决我的问题的方法:)

我以某种方式得到这个错误:

无法绑定到'ng-model',因为它不是已知的本机属性

我没有在Ionic中看到@Component,所以页面配置如下:

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

我的模板是这样的:

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

我正在使用Ionic 2.

干杯

Yar*_*mer 9

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