I'm trying to build a hybrid app when the AngularJS files are both JS and TS. I can't seem to add a route to a JS controller.
I'm relying on the following example and doing the following:
const statesConfigBlock = ['$stateProvider', $stateProvider => {
$stateProvider.state('main', {
url: '/main',
templateUrl: 'app/components/layout/mainView.html',
controller: 'mainController as main'
})
}];
appModuleAngularJS.config(statesConfigBlock);
while I have a mainCtrl.js
file that's defined as:
var app = angular.module('myApp', []);
(function(app) {
'use strict';
app.controller('mainController', [
function () {
console.log("blah");
}]);
})(app);
when I run the app I get:
The controller with the name 'mainController' is not registered
but I do see it when I run in console:
angular.module('myApp')._invokeQueue.filter(function(el){
return el[0] === "$controllerProvider";
}).map(function(el){
return el[2]["0"];
});
appModuleAngularJS
is defined? – EliottsampleAppModuleAngularJS
here – Marivaux