本文整理匯總了TypeScript中angular.IScope.%24apply方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IScope.%24apply方法的具體用法?TypeScript IScope.%24apply怎麽用?TypeScript IScope.%24apply使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular.IScope
的用法示例。
在下文中一共展示了IScope.%24apply方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: subscribeOnScope
subscribeOnScope($scope, isPhonePortraitStream(), (isPhonePortrait) => {
$scope.$apply(() => {
console.log('isPhonePortrait', isPhonePortrait);
vm.placeholder = isPhonePortrait
? t('Header.FilterHelpBrief')
: t('Header.FilterHelp', { example: 'is:dupe' });
});
});
示例2: fn
function callInDigest<T extends any[]>($scope: IScope, fn: (...args: T) => void, ...args: T) {
try {
// this is terrible, but necessary to synchronously deliver subscription values
// to angular scopes. This is required by some APIs, like the `config` service,
// and beneficial for root level directives where additional digest cycles make
// kibana sluggish to load.
//
// If you copy this code elsewhere you better have a good reason :)
if ($scope.$root.$$phase) {
fn(...args);
} else {
$scope.$apply(() => fn(...args));
}
} catch (error) {
fatalError(error);
}
}
示例3:
dimDestinyTrackerService.getItemReviews(vm.item).then(() => $scope.$apply());
示例4:
dimVendorService.requestRatings().then(() => $scope.$apply());