注入控制器后,$ ionicHistory无法正常工作

时间:2017-04-19 08:15:05

标签: angularjs ionic-framework

abcApp.controller(                ' tgroupCtrl&#39 ;,                 [' $ ionicHistory',函数($范围,$ ionicHistory)                        {                          $ scope.subheader =" Daily Drills&#34 ;;                         }                ]               );

我得到的错误是

ionic.bundle.js:17696错误:[$ injector:unpr]未知提供者:$ ionicHistoryProvider< - $ ionicHistory< - Ihistory

2 个答案:

答案 0 :(得分:0)

angular.module('abcApp', ['ionicModuleOrWhatever'])
.controller('tgroupCtrl', ['$ionicHistory', function ($ionicHistory) {
    // Do something with $ionicHistory
}]);

答案 1 :(得分:0)

var abcApp = angular.module('abcApp',['ionic'])
abcApp.controller ( 'tgroupCtrl', ['$ionicHistory',function($scope,$ionicHistory) { $scope.subheader = "Daily Drills"; } ] );

<强>复制

Cannot inject $ionicHistory into my angularjs controller