嘗試將$ ionicHistory注入服務本身。 我可以這樣寫嗎?
.service('$ionicUtilityService', ['CONSTANT', '$log', '$ionicHistory', function(CONSTANT, $log, $ionicHistory) {
var apis = {};
apis.clearNavigationHistory = function() {
$ionicHistory.clearHistory();
};
return apis;
}]);
我收到錯誤
Error: $ionicHistory is undefined [email protected]http://localhost:8100/js/services.min.js:1:6223 @http://localhost:8100/components/customer/home/home-controller.min.js:1:206 jf/this.$gethttp://localhost:8100/lib/ionic/js/ionic.bundle.min.js:170:424 D.create/[email protected]http://localhost:8100/lib/ionic/js/ionic.bundle.min.js:446:19204 D.create/[email protected]http://localhost:8100/lib/ionic/js/ionic.bundle.min.js:446:18728
你可以在第一行放置一個斷點,並檢查離子本身是否已加載點? –