我有一個文本類型的輸入,我需要這個輸入變成跨度取決於我的模型屬性的值。所以,我對成爲跨度輸入jquery的功能是:長角度角度模型屬性變化輸入類
$('.read').replaceWith(function(){
return '<span class='+this.className+'>'+this.value+'</span>'
});
而且我已經使用了NG指令是:NG-變化:
<input id="1" type="text" ng-model="src.ViewModel.Model.DataA" ng-change="src.search(src.ViewModel.Model.DataA)"/>
的方法是:
theController.prototype.search = function(data){
if (data == 1)
{
theModel.DataA = data;
$('.read').replaceWith(function(){
return '<span class='+this.className+'>'+this.value+'</span>';
});
}
};
和必須改變輸入是:
<input type="text" ng-model="src.ViewModel.Model.DataB" ng-class="{'read': src.ViewModel.Model.DataA == 1}" />
但它不起作用,所以,我該如何解決?
這裏是我的小提琴:Fiddle
任何幫助或建議,請...