I'm trying to compartmentalize an Angular app and running into issues getting the ngView working properly. The route seems to be configured correctly, as when I log its properties I get: $route
, $routeParams
, and $location
, I get:
Object {routes: Object, reload: function, updateParams: function}
Object {}
and
LocationHtml5Url {$$html5: true, $$protocol: "http", $$host: "localhost", $$port: 3000, $$parse: function…}
I read here that the $routeParams
can appear empty due to its aynchrynous nature, so I don't think thats an issue, but I'm not sure what I'm missing.
Heres the err message:
GET http://localhost:3000/partials/projectBlocks 404 (Not Found)
I know I'm supposed to be routing relative to the root of my app, which I believe I am, so I'm not sure why its looking for the partial in what appears to be the ../public/.../ folder (app is typical express structure)
Heres my code:
jade view (in ./views)
div(ng-controller='projects')
div(ng-view)
partial view (./views/partials)
p hey you found me!
controller (in /public/ directory)
angular.module('mean-man')
.controller('projects', ['$scope', '$http', '$route', '$routeParams', '$location', function($scope, $http, $route, $routeParams, $location){
console.log($route);
console.log($routeParams);
console.log($location);
this.$route = $route;
this.$location = $location;
this.$routeParams = $routeParams;
angular app.js file (in /public/ directory)
(function(){
angular.module('mean-man', ['ngRoute','ngAnimate','mm.foundation'])
.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider){
$routeProvider
.when('/:member', {
templateUrl: 'partials/projectBlocks',
controller: 'projects',
controllerAs: 'project'
});
$locationProvider.html5Mode({enabled:true,requireBase:false});
}]);
})();
I was going off the AngularJS official documentation and this site, so my code may be a mix of the two, thanks for any help / references!