I am triyng to reach a simple app that return result from a MongoDB I am getting this 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
});
});
What am I doing wrong?
.
(dot) and use semicolon OR removemid.
you need to go like Object chaining.;
s then do it always unless necessary or use them. Don't do both.