0

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

Trying to get a simple timer directive to work on a fitness app, the 3rd line

<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>

It seems to have installed correctly in bower, in my index.html I have this line and it seems fine:

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

than in my controller file :

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);
  // });
})

this has worked before for previous directives I've installed... this is the error I get

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

1 Answer 1

1

You're including the wrong file. You should include the angular-timer.js file that's in the dist folder.

<script src="lib/angular-timer/dist/angular-timer.js"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

Nice, now it just says humanize duration is not defined, so i guess I have to install that too
Looks like you need momentjs also, in case you don't already have it. github.com/siddii/angular-timer#requirements

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.