I'm new in Angular, and I'm trying to understand the basic My Project is like Mean.
My router.js
router.get('/', function (req, res, next) {
res.render('index', {});
});
my Angularfile.js
var app = angular.module('ibApp', ['ngRoute','ui.router']);
app.config([
'$stateProvider',
'$urlRouterProvider',
function ($stateProvider, $urlRouterProvider) {
$stateProvider.state('home', {
url: '/',
resolve: {
foo: [function () {
console.log('inside')
}]
}
});
$urlRouterProvider.otherwise('home');
}]);
app.controller("MyCtrl",['$scope',function($scope) {
console.log("here!");
}]);
my index.html
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.1/angular-route.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.10/angular-ui-router.js"></script>
<script src="/javascripts/angularApp.js"></script>
But when I get the / (index) route, I haven't console.log('inside'), but I have only console.log("here");
I tried also http://localhost:3000/#/, but my problem persist.
()to ensure the function executes.