Ivan_nn2
Ivan_nn2

Reputation: 469

Angular animate error during loading

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 :) ?..

Upvotes: 6

Views: 4375

Answers (1)

Sunil D.
Sunil D.

Reputation: 18193

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';
    ...
}

Upvotes: 0

Related Questions