我正在尝试使用ng-if
更新show / hide div,其中ng-if的值从controller更新。我使用Controller as
语法而不是$ scope
HTML文件
<div layout="row" ng-controller="TabColController as tc">
<div ng-if="tc.hasErrors">
Currently this part of the site is not working
</div>
</div>
Controller.js
var tableColumns={
tableColumns:function(tabColFactory){
this.hasErrors = false;
this.getTiersData=function(param){
let params = {
url:'tierData'
};
tabColFactory.getTiers(params).then(function(resp){
this.hasErrors = true;
//consoling this here is showing value of hasError as true, but div is not yet shown in UI
console.log(this);
this.filterTierOneData(resp);
}.bind(this),function (err) {
console.log(err);
}.bind(this));
}.bind(this);
this.filterTierOneData=function(resp){ }.bind(this);
return this.getTiersData();
}
};
export default tableColumns;