无法使angular-timer指令运行

时间:2015-10-07 04:55:41

标签: javascript angularjs timer

http://siddii.github.io/angular-timer/examples.html#/angularjs-single-timer

尝试使用简单的计时器指令来处理健身应用程序,第3行

<ion-view view-title="Add/Edit Workout" ng-controller="WorkoutEditsCtrl">
    <ion-nav-buttons side="secondary">
     <h3><timer /></h3>

        <!-- <h1 class="title">{{workout.name}}</h1> -->

            <button class="button button-icon ion-compose"ng-click="addEx(); startTimer()"></button>

    </ion-nav-buttons>
    <ion-content>

它似乎已经在凉亭中正确安装,在我的index.html中我有这条线,看起来很好:

<script src="lib/angular-timer/app//js/_timer.js"></script>

而不是我的控制器文件:

var contollers = angular.module('CovalentFitness.controllers', ['timer'])

contollers.controller('WorkoutEditsCtrl', function($scope, $location, $ionicModal, WorkoutServices) {
  //Timer

  // $scope.timerRunning = true;

  // $scope.startTimer = function (){
  //     $scope.$broadcast('timer-start');
  //     $scope.timerRunning = true;
  // };

  // $scope.stopTimer = function (){
  //     $scope.$broadcast('timer-stop');
  //     $scope.timerRunning = false;
  // };

  // $scope.$on('timer-stopped', function (event, data){
  //     console.log('Timer Stopped - data = ', data);
  // });
})

之前已经安装过以前的指令...... 这是我得到的错误

Error: [$injector:unpr] Unknown provider: I18nServiceProvider <- I18nService

1 个答案:

答案 0 :(得分:1)

你包含了错误的文件。您应该包含angular-timer.js文件夹中的dist文件。

<script src="lib/angular-timer/dist/angular-timer.js"></script>