Include Angular in Hackathon-Starter

I am completely new. I am trying to enable Angular in https://github.com/sahat/hackathon-starter Boilerplate. I turned on

//= require lib/ui-bootstrap-tpls-0.11.0

//= require lib/angular

in application.js and two files in the lib folder. However, the application does not yet work on Angular. What am I doing wrong? Where can I put my code for controllers / directives, etc.?

+1
source share
2 answers

Using Hackathon-starter-angular (HSA) does not answer the questions that were mentioned in the post. HSA includes AngularJS globally in the layout.jade file, which may mean that all routes are served by AngularJS and these pages are not indexed by search engines such as google.

/ AngularJS hackathon-starter - . :

1) , . , . angularEntry.js

exports.getPagesServedByAngular = function (req, res) {
    res.render('shop/index', {
        title: 'Entry point to AngularJS pages'
    });
};

2) app.js

// reference the controller
var angularPagesController = require('./controllers/angular');
// use it
app.get('/shop', angularPagesController.getPagesServedByAngular);

3) (, ) (, index.jade). Angular. :

extends ../layout
block content 
  .page-header
    h3 Services
    body(data-ng-app='miniApp')    
    p first test expression from views/index.jade: {{ 5 + 5 }}
    div(data-ng-view)

4) app.js public/js -. :

angular.module('miniApp', ['ngRoute']);
angular.module('miniApp').config(function ($routeProvider) {
    $routeProvider
        .when('/', {
            templateUrl: 'views/test.html'
        })
        .when('/detailTest', {
            templateUrl: 'views/detailTest.html'
        })
});

5) angular.js angular -route.js public/js/lib

6) public/js/application.js :

//= require lib/angular
//= require lib/angular-route
//= require app

7) , test.html detailTest.html public/views

Angular. , / public/js.

+2
+1

All Articles