尝试调用$scope.$apply
,但抛出错误说:
$ scope。$ apply不是函数
以下是代码:
function loadUnitChanged(event, data) {
console.log('Event Info: ', event);
setTimeout(function () {
$scope.$apply(function () {
$scope.cargoregisters = createArrayFromLoadUnit(data);
});
}, 2000);
}
=============================================== ==========
angular.module('portwin.cargo').controller('CargoController', function ($rootScope, $location, $timeout, $mdDialog, cargoGateway) {
var $scope = this;
// Event handlers
$rootScope.$on('cargodetails:loaded', cargoDetailBaseDataLoaded);
$rootScope.$on('cargoRegistration:loaded', cargoRegistrationBaseDataLoaded);
$rootScope.$on('loadUnit:changed', loadUnitChanged);
$rootScope.$on('loadUnit:Saved', updateLoadUnitAfterSave);
答案 0 :(得分:0)
编辑: 由于您可以根据您的评论访问$ scope,我会这样做......
...
public static class SubClassView extends LinearLayout {
...