本文整理匯總了TypeScript中app/core/services/backend_srv.setBackendSrv函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setBackendSrv函數的具體用法?TypeScript setBackendSrv怎麽用?TypeScript setBackendSrv使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setBackendSrv函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
/** @ngInject */
constructor(
$scope,
utilSrv,
$rootScope,
$controller,
contextSrv,
bridgeSrv,
backendSrv: BackendSrv,
timeSrv: TimeSrv,
datasourceSrv: DatasourceSrv,
angularLoader: AngularLoader
) {
// make angular loader service available to react components
setAngularLoader(angularLoader);
setBackendSrv(backendSrv);
setDatasourceSrv(datasourceSrv);
setTimeSrv(timeSrv);
configureStore();
$scope.init = () => {
$scope.contextSrv = contextSrv;
$scope.appSubUrl = config.appSubUrl;
$scope._ = _;
profiler.init(config, $rootScope);
utilSrv.init();
bridgeSrv.init();
};
$rootScope.colors = colors;
$scope.initDashboard = (dashboardData, viewScope) => {
$scope.appEvent('dashboard-fetch-end', dashboardData);
$controller('DashboardCtrl', { $scope: viewScope }).init(dashboardData);
};
$rootScope.onAppEvent = function(name, callback, localScope) {
const unbind = $rootScope.$on(name, callback);
let callerScope = this;
if (callerScope.$id === 1 && !localScope) {
console.log('warning rootScope onAppEvent called without localscope');
}
if (localScope) {
callerScope = localScope;
}
callerScope.$on('$destroy', unbind);
};
$rootScope.appEvent = (name, payload) => {
$rootScope.$emit(name, payload);
appEvents.emit(name, payload);
};
$scope.init();
}
示例2: constructor
/** @ngInject */
constructor(
$scope,
alertSrv,
utilSrv,
$rootScope,
$controller,
contextSrv,
bridgeSrv,
backendSrv: BackendSrv,
datasourceSrv: DatasourceSrv
) {
// sets singleston instances for angular services so react components can access them
setBackendSrv(backendSrv);
createStore({ backendSrv, datasourceSrv });
$scope.init = function() {
$scope.contextSrv = contextSrv;
$scope.appSubUrl = config.appSubUrl;
$scope._ = _;
profiler.init(config, $rootScope);
alertSrv.init();
utilSrv.init();
bridgeSrv.init();
$scope.dashAlerts = alertSrv;
};
$rootScope.colors = colors;
$scope.initDashboard = function(dashboardData, viewScope) {
$scope.appEvent('dashboard-fetch-end', dashboardData);
$controller('DashboardCtrl', { $scope: viewScope }).init(dashboardData);
};
$rootScope.onAppEvent = function(name, callback, localScope) {
const unbind = $rootScope.$on(name, callback);
let callerScope = this;
if (callerScope.$id === 1 && !localScope) {
console.log('warning rootScope onAppEvent called without localscope');
}
if (localScope) {
callerScope = localScope;
}
callerScope.$on('$destroy', unbind);
};
$rootScope.appEvent = function(name, payload) {
$rootScope.$emit(name, payload);
appEvents.emit(name, payload);
};
$scope.init();
}