javascript - Angular-Sprout: module.controller() function is not defined; unable to add controller -
javascript - Angular-Sprout: module.controller() function is not defined; unable to add controller -
i've been using angular-seed starter project, , although has changed app construction within past month or i've decided take @ angular-sprout.
angular-sprout doesn't have updated index-async page, decided fork code , work on it. i've got wired correctly, when seek add together controller (via module.controller()
function, receive error saying module.controller
undefined.
when log angular.module('mymodule')
console on index-async.html
page, angular object right methods - filter()
, service()
, provider()
, etc - controller
isn't there:
module object { _invokequeue: array[0], _runblocks: array[0], requires: array[0], name: "application.controllers", provider: function…} _invokequeue: array[0] _runblocks: array[0] config: function (){c[d||"push"]([a,b,arguments]);return g} constant: function (){c[d||"push"]([a,b,arguments]);return g} directive: function (){c[d||"push"]([a,b,arguments]);return g} factory: function (){c[d||"push"]([a,b,arguments]);return g} filter: function (){c[d||"push"]([a,b,arguments]);return g} name: "application.controllers"provider: function (){c[d||"push"]([a,b,arguments]);return g} requires: array[0]run: function (a){d.push(a);return this} service: function (){c[d||"push"]([a,b,arguments]);return g} value: function (){c[d||"push"]([a,b,arguments]);return g} __proto__: object }
(sorry terrible formatting. i'll seek improve console copy.)
when log controller
index-async:
controller undefined details-controller.js:13
this happens when run index-async page. however, on regular index page, controller
defined correctly , gives me angular method:
controller function () { invokequeue[insertmethod || 'push']([provider, method, arguments]); homecoming moduleinstance; } details-controller.js:13
has run before? it's worth, seems though controller
module method i'm missing, , have absolutely no thought why might be.
as turns out....i decided check version of angular-loader using. apparently, angular loader v1.0.0rc1 seems cause error, if i'm using version of angularjs. updated loader later version seems prepare issue reason.
to note, there no problem code itself. turns out, according documentation loader overrides angular.module()
, seems root of problem experienced.
to this, had clone angular-seed , run npm run update-index-async
latest version of loader code. copying sprout project seemed prepare problem angular 1.0. (now, working latest version of angular.) if you're using script tag loader (not injecting straight html page), can grab latest version , link document.
javascript angularjs controller angular-sprout
Comments
Post a Comment