我正在使用带有打字稿的旧版 angularjs 1.5。活动用户卡中的数据在父级更改时未更新
家长
<active-user-card active-users="response.activeUsers"></active-user-card>
活跃用户卡
export class ActiveUserCard {
activeUsers: number;
data: Array<IChartData>;
constructor() {
........
........
this.inactiveUsers = (totalUsers - this.activeUsers) || 0;
this.data = [
{name: "Active users", y: this.activeUsers},
{name: "Inactive users", y: this.inactiveUsers}
];
........
........
}
}
angular.module('tm')
.directive('activeUserCard', [function() {
return {
restrict: 'E',
scope: {
activeUsers: '<'
},
bindToController: true,
controller: ActiveUserCard,
controllerAs: 'auc',
templateUrl: "./active-user-card.html"
};
}]);
守着一只汪
相关分类