I create a “Common” service (factory) in AngularJS like this:
angular.module('myApp')
.factory('Common', function($state) {
...
In my controller, I bind my service with my view like this:
angular.module('myApp')
.controller('myCtrl', function($scope, Common) {
$scope.C = Common;
...
But in my view, I can’t access to the methods of my service … why?
Like this:
<element ng-click="C.foo()" />
I used this trick in several AngularJS projects so I know it should work.