मैं AngularJS में config
विधि में $window
वस्तु इंजेक्षन करने की कोशिश कर रहा हूँ, लेकिन मैं एक त्रुटि प्राप्त हो रही में `config` पर आपत्ति window` करने के लिए ...
क्या है ऐसा करने का सही तरीका?
angular.module('myApp', ['$window']) //is this wrong?
.config(function ($window) { //this is not the way?
console.log($window); //console.log fails //error
})
.controller("main", function($scope) {
$scope.index = 0;
$scope.num = number[$scope.index];
$scope.increase = function() {
$scope.index += 1;
$scope.num = number[$scope.index];
}
})
आप क्या करने की कोशिश कर रहे हैं? कई सेवाएं .config ब्लॉक में उपलब्ध नहीं होंगी। आपको शायद .run istead का उपयोग करने का प्रयास करना चाहिए। – cbass
कॉन्फ़िगरेशन में $ विंडो का उपयोग करने के लिए अपने उपयोग मामले को आईडीक करें? क्या आप स्थान लाने की कोशिश कर रहे हैं? – kishanio