6

I'm developing this angular simple page. I'm using Bower to install components that i need, and the application used to work perfectly. Until I decided to exploit Angular animate library. At first time I used Bower that asked me which "suitable" Angular library should be used : the 1.2.6 (that was already installed and working) or the 1.2.14.

So if I chose 1.2.6 the error coming out just after adding the

var mainApp = angular.module('myStopApp', [
  'ngCookies',
  'ngResource',
  'ngSanitize',
  'ngRoute',
  'ngAnimate',
  'myStopModule'
])

is

Uncaught Error: [$injector:unpr] Unknown provider: $$asyncCallbackProvider <- $$asyncCallback <- $animate <- $compile

if i choose the other version the problem moves to the code where it seems to not recognize the use of ng-class..

I have an element with ng-class="testClass" and a list element where i have :

ng-click="selectStop(stop); testClass='stop-active'"

where i have in animations.css:

.stop-active-add, .stop-active-remove {
  -webkit-transition:all linear 0.5s;
  -moz-transition:all linear 0.5s;
  -o-transition:all linear 0.5s;
  transition:all linear 0.5s;
  display:block!important;
}

.stop-active-add.add-active,
.stop-active-remove {
  opacity:0;
}

.stop-active-add,
.stop-active-remove.-remove-active {
  opacity:1;
}

While loading page i have an error saying:

[$parse:syntax] Syntax Error: Token '=' implies assignment but [selectStop(stop); testClass] can not be assigned to...

It seems that both the first function and the using of css hook of angular cannot be together in the same ng-click.

Can i have a solution for at least one of the two problems :) ?..

Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
Ivan_nn2
  • 469
  • 7
  • 20
  • I have a similar if not identical problem. When I download the 1.2.6 animation library from the angular website and reference it, everything works. If I use bower and download the exact same file (1.2.6, plus I opened them and checked) it throws the same injector error. Very strange...The only difference is how the file is gotten. – user2483724 Apr 11 '14 at 23:04
  • For me it started to work everything after I took off angular animate from the bower built section in index.html file. After the closing of these line comments: , so after ... I put the reference to the angular-animate library there, and even when using "grunt serve" I didn't have problem... I don't know why but Bower continued to take off angular-animate.js from the block of the library files.. – Ivan_nn2 Apr 12 '14 at 13:10

1 Answers1

0

Angular seems to have changed what they allow you to do in the expression for your click handler. Why not just put the assignment statement inside the function that you're already calling in the click handler?

ng-click="selectStop(stop)"

And then in the selectStop() function:

$scope.selectStop = function(arg) {
    testClass = 'stop-active';
    ...
}
Sunil D.
  • 17,983
  • 6
  • 53
  • 65
  • Hi, I wanted to remain in the View scope for managing the animations. In the end I just apply the ng-show element with a boolean value that is changed in selectStop method. You pointed me in the right direction. – Ivan_nn2 Mar 17 '14 at 09:51
  • @Ivan_nn2 it would have been better to upvote this as helpful and provide a correct answer of your own. – isherwood Nov 03 '15 at 14:44