I have the following set up within my app.js
file:
require('angular');
require('angular-ui-router');
var storelistingCtrl = require('./controllers/storeListingsCtrl');
var ngApp = angular.module('ngApp', ['ui.router'], function($interpolateProvider){
//-- as the output conflicts with blade lets alter the defaults
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
})
.config(['$stateProvider','$logProvider','$urlRouterProvider', function ($stateProvider, $logProvider,$urlRouterProvider) {
$logProvider.debugEnabled(true);
}])
//-- controllers
ngApp.controllers('storelistingCtrl', ['$scope', storelistingCtrl]);
And with in my storelistingCtrl.js
file i just have a simple output to test:
module.exports = function($scope) {
console.log('loaded');
};
But I am getting the following error:
Uncaught TypeError: undefined is not a function.
Error: [ng:areq] http://errors.angularjs.org/1.2.18/ng/areq?p0=storelistingCtrl&p1=not%20a%20function%2C%20got%20undefined
.....
Am i missing something?
UPDATE
See my answer, Always sort it once i posted on here.
The Angular controller is spelt wrong it should be:
ngApp.controller('storelistingCtrl...
and not controllers
..
Also the controller name is case sensitive so it needs a capital 'L' for Listing...
ngApp.controller('storelistingsCtrl...
becomes
ngApp.controller('storeListingCtrl...
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments