I am testing my annular application with jasmine () and getting the next error: Unknown Provider: $ scopeProvider & lt; - $ scope I know it's wrong to make dependencies with the scope of filters, services, factories, etc., but I use $ scope in the controller! Why am I getting this error? Controller looks like
testModule.controller ('TestCont', ['$ filter', '$ scope', function ($ filter, $ radius) {var doPrivateShit = function () {console Log (10);}; this.lol = function () {doPrivateShit ();}; this.add = function (a, b) {return a + b;}; this.upper = function (a) {return $ Filter ('uppercase') (A);} $ scope.a = this.add (1,2); $ scope.test = 10; $ scope.search = {};}]);
and my test code:
'strict experiment'; Describe ('test module module', function () (first) () (function () (module ('test module');}); ('uppercase must be correctly', injection (function ($ controller ) {Var testCont = $ controller (hopefully (testCont.upper ('lol')). ToEqual ('LOL'); Hopefully (testCont.upper ('jumpEr')). Extra ('Jumper'); Expect (testCont.upper ('123azaza')). (Explet ('123Ajaz'); Hopefully (testCont.upper ('111')) toEqual ('111');}));});
You need to manually enter a $ scope
Your controller: <'> test module', function () {first (module ('test module')); description ('test controller', function () {var scope, before testCont; (injection ($ root) Scope, $ controller) {Scope = $ Rootscope. $ New (); testCont = $ controller ('testcount', {$ scope: scope}}}}; (', work () {hope (testCont.upper (' Lol ')). ToEqual (' LOL '); ...}}}}}};