本文整理匯總了TypeScript中angular.IScope.%24on方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IScope.%24on方法的具體用法?TypeScript IScope.%24on怎麽用?TypeScript IScope.%24on使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular.IScope
的用法示例。
在下文中一共展示了IScope.%24on方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
public $onInit(): void {
const { $scope, $rootScope, $timeout, app } = this;
const filterModel = ClusterState.filterModel.asFilterModel;
this.sortFilter = filterModel.sortFilter;
this.tags = filterModel.tags;
this.groupsUpdatedSubscription = ClusterState.filterService.groupsUpdatedStream.subscribe(
() => (this.tags = filterModel.tags),
);
if (app.serverGroups.loaded) {
this.initialize();
}
app.serverGroups.onRefresh($scope, () => this.initialize());
this.locationChangeUnsubscribe = $rootScope.$on('$locationChangeSuccess', () => {
$timeout(() => {
filterModel.activate();
ClusterState.filterService.updateClusterGroups(app);
});
});
$scope.$on('$destroy', () => {
this.groupsUpdatedSubscription.unsubscribe();
this.locationChangeUnsubscribe();
});
}
示例2:
public $onInit(): void {
const { loadBalancerFilterModel, loadBalancerFilterService, app, $scope, $rootScope } = this;
const filterModel = loadBalancerFilterModel.asFilterModel;
this.tags = filterModel.tags;
this.groupsUpdatedSubscription = loadBalancerFilterService.groupsUpdatedStream
.subscribe(() => {
// need to applyAsync because everything else is happening in React now; will replicate when converting clusters, etc.
$scope.$applyAsync(() => this.tags = filterModel.tags);
});
if (app.loadBalancers && app.loadBalancers.loaded) {
this.initialize();
}
app.loadBalancers.onRefresh($scope, () => this.initialize());
this.locationChangeUnsubscribe = $rootScope.$on('$locationChangeSuccess', () => {
filterModel.activate();
loadBalancerFilterService.updateLoadBalancerGroups(app);
});
$scope.$on('$destroy', () => {
this.groupsUpdatedSubscription.unsubscribe();
this.locationChangeUnsubscribe();
});
}
示例3:
public $onInit(): void {
const { $scope, $rootScope, app, SecurityGroupFilterModel, securityGroupFilterService } = this;
this.sortFilter = SecurityGroupFilterModel.sortFilter;
this.tags = SecurityGroupFilterModel.tags;
$scope.$on('$destroy', $rootScope.$on('$locationChangeSuccess', () => {
SecurityGroupFilterModel.activate();
securityGroupFilterService.updateSecurityGroups(app);
}));
this.initialize();
app.securityGroups.onRefresh($scope, () => this.initialize());
}
示例4: function
controller: function(
$window: IWindowService,
$scope: IScope,
$state: StateService,
$rootScope: IScope) {
'ngInject';
const reduceModeKey = 'gv-sidenav-reduce-mode';
this.$window = $window;
this.reducedMode = false;
this.$onInit = () => {
if (this.$window.localStorage.getItem(reduceModeKey) !== null) {
this.reducedMode = JSON.parse(this.$window.localStorage.getItem(reduceModeKey));
}
};
this.toggleReducedMode = () => {
this.reducedMode = !this.reducedMode;
$window.localStorage.setItem(reduceModeKey, this.reducedMode);
$rootScope.$broadcast('onWidgetResize');
};
this.isActive = function (menuItem) {
let menuItemSplitted = menuItem.name.split('.');
let currentStateSplitted = $state.current.name.split('.');
return menuItemSplitted[0] === currentStateSplitted[0] &&
menuItemSplitted[1] === currentStateSplitted[1];
};
$scope.$on('reduceSideNav', () => {
if (!this.reducedMode) {
this.toggleReducedMode();
}
});
}
示例5:
public $onInit(): void {
const { LoadBalancerFilterModel, loadBalancerFilterService, app, $scope, $rootScope } = this;
this.tags = LoadBalancerFilterModel.tags;
if (app.loadBalancers.loaded) {
this.initialize();
}
app.loadBalancers.onRefresh($scope, () => this.initialize());
$scope.$on('$destroy', $rootScope.$on('$locationChangeSuccess', () => {
LoadBalancerFilterModel.activate();
loadBalancerFilterService.updateLoadBalancerGroups(app);
}));
}
示例6: D2InventoryController
function D2InventoryController(
this: IController & {
account: DestinyAccount;
},
$scope: IScope,
D2StoresService: StoreServiceType
) {
'ngInject';
const vm = this;
this.$onInit = () => {
getBuckets().then((buckets) => {
vm.buckets = buckets;
subscribeOnScope($scope, D2StoresService.getStoresStream(vm.account), (stores) => {
if (stores) {
vm.stores = stores;
}
});
});
};
$scope.$on('dim-refresh', () => {
D2StoresService.reloadStores();
});
}
示例7: VendorsController
function VendorsController(
this: IController & {
account: DestinyAccount;
settings: typeof settings;
},
$scope: IScope
) {
'ngInject';
const vm = this;
vm.activeTab = 'hasArmorWeaps';
vm.activeTypeDefs = {
armorweaps: ['armor', 'weapons'],
vehicles: ['ships', 'vehicles'],
shadersembs: ['shaders', 'emblems'],
emotes: ['emotes']
};
vm.settings = settings;
this.$onInit = () => {
subscribeOnScope($scope, dimVendorService.getVendorsStream(vm.account), ([stores, vendors]) => {
vm.stores = stores;
vm.vendors = vendors;
vm.totalCoins = dimVendorService.countCurrencies(stores, vendors);
dimVendorService.requestRatings().then(() => $scope.$apply());
});
};
$scope.$on('dim-refresh', () => {
dimVendorService.reloadVendors();
});
}
示例8:
public $onInit(): void {
const { $scope, $rootScope, ClusterFilterModel, clusterFilterService, app } = this;
this.sortFilter = ClusterFilterModel.sortFilter;
this.tags = ClusterFilterModel.tags;
if (app.serverGroups.loaded) {
this.initialize();
}
app.serverGroups.onRefresh($scope, () => this.initialize());
$scope.$on('$destroy', $rootScope.$on('$locationChangeSuccess', () => {
ClusterFilterModel.activate();
clusterFilterService.updateClusterGroups(app);
}));
}
示例9: constructor
constructor ($scope: IScope, $element: IAugmentedJQuery, event: string, fn: any) {
this.$element = $element
this.event = event
this.fn = fn
$scope.$on('$destroy', () => {
this.$element.unbind(this.event, this.fn)
})
}
示例10:
export function subscribeOnScope<T>(
$scope: IScope,
observable: Observable<T>,
subscribeFn: (T) => void
): Subscription {
const subscription = observable.subscribe(subscribeFn);
$scope.$on('$destroy', () => subscription.unsubscribe());
return subscription;
}