无法更新angular.js中的ui视图

时间:2017-09-10 07:17:27

标签: javascript angularjs

我正在尝试使用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;

0 个答案:

没有答案