Skip to content

Instantly share code, notes, and snippets.

@astemborskim
Last active August 29, 2015 14:15
Show Gist options
  • Save astemborskim/8b37fb1f919048671b5f to your computer and use it in GitHub Desktop.
Save astemborskim/8b37fb1f919048671b5f to your computer and use it in GitHub Desktop.
MEAN stack with Jade issue - Angular Directives in view not working
app.controller('animalsController', ['$scope',
function ($scope){
$scope.test = "This is a test";
$scope.animals = [
{ category : "Cats" },
{ category : "Dogs" },
{ cateogry : "Fish" },
{ category : "Reptiles" },
{ category : "Small Animals" }
]
}]);
var app = angular.module('myApp', [])
docutype
html
head(ng-app="myApp")
title AniDopt - #{title}
body
h1
| AniDopt Pet Adoption Services and Community Portal
p
| Welcome to the AniDopt Adoption Service and Community Portal site.
| This online service is intended to assist those looking for pets to
| be able to browse availabe animals in need of a good home. You will
| also find other community users to discuss various topics about animal
| adoption and care. Enjoy!
div(ng-controller = "animalsController")
ul
li {{test}}
li(ng-repeat="animal in animals") {{animal.category}}
script( src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js")
script( text='text/javascript' src="/app.js")
script( text="text/javascript" src="/js/controllers/animals-controller.js")
var express = require('express');
var router = express.Router();
router.get('/', function (req, res) {
res.render('index',
{title : 'Home'}
)
});
module.exports = router;
var express = require('express'),
app = express();
//routes defined
var routes = require('./client/js/routes/index');
//View engine config
app.set('views', __dirname + '/client/views');
app.set('view engine', 'jade');
app.use(express.static(__dirname + '/client/'));
//get route
app.get('/', routes);
//Start server on port 3000
app.listen(3000, function () {
console.log("Server is listening...");
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment