I am currently working on developing a basic app that retrieves data from MongoDB. However, I encountered an error in the console:
Uncaught TypeError: Cannot read property 'controller' of undefined at model.js:8
'use strict';
var mid = angular.module('mid', [
'ngRoute'
]).
mid.controller('pageCtrl', function($scope, $http){ <------- This line
$scope.pages = [];
$http({
method: 'GET',
url: 'http://127.0.0.1/pages'
})
.then(function(pages) {
$scope.pages = pages.data;
})
.catch(function(errRes) {
// Handle errRess
});
});
Could someone please help me identify what might be causing this error?