Init Angular

This commit is contained in:
Bruno SIMON
2016-06-03 18:06:55 +02:00
parent c9e2a20343
commit b61ddb5967
6 changed files with 124 additions and 1 deletions
+4
View File
@@ -8,6 +8,7 @@ let express = require( 'express' ),
colors = require( 'colors' ),
ip = require( 'ip' ),
util = require( 'util' ),
path = require( 'path' ),
Projects = require( './models/projects.class.js' )
/**
@@ -73,6 +74,9 @@ class App
// Set up
this.express = express()
this.express.use( helmet() )
this.express.set( 'view engine', 'jade' );
this.express.set( 'views', path.join( __dirname, 'views' ) );
this.express.use( express.static( path.join( __dirname, 'public' ) ) );
// Controllers
this.express.use( '/codes', require( './controllers/index.js' ) )
+1 -1
View File
@@ -3,7 +3,7 @@ var express = require( 'express' ),
router.get( '/', function( request, response )
{
response.send( 'Hello' );
response.render( 'index/index.jade', {} );
} );
module.exports = router;
+1
View File
@@ -22,6 +22,7 @@
"express": "^4.13.4",
"helmet": "^2.1.0",
"ip": "^1.1.3",
"jade": "^1.11.0",
"socket.io": "^1.4.6"
}
}
@@ -0,0 +1,20 @@
var angular_module = angular.module( 'application', [] );
angular_module.controller(
'ApplicationController',
[
'$scope',
'data',
function( $scope, data )
{
console.log(data);
this.pwet = 'uh';
this.codes =
[
{ title: 'Title 1' },
{ title: 'Title 2' }
];
}
]
);
+12
View File
@@ -0,0 +1,12 @@
angular_module.factory(
'data',
[
function()
{
return function()
{
console.log( 'data' );
}
}
]
);
+86
View File
@@ -0,0 +1,86 @@
html(ng-app="application")
head
title
| Code Spectat
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js")
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-route.js")
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-resource.js")
script(src="/javascript/application/application.js")
script(src="/javascript/services/data.js")
body
header.main-header
h1
| Code Spectat
aside
header.aside-header
| Project name
nav.aside-nav
ul
li
a(href="#")
| folder-1
ul
li
a(href="#")
| folder-1-1
li
a(href="#")
| folder-1-2
li
a(href="#")
| file-1-1
li
a(href="#")
| file-1-2
li
a(href="#")
| folder-2
ul
li
a(href="#")
| folder-2-1
ul
li
a(href="#")
| folder-2-1-1
li
a(href="#")
| file-2-1-1
li
a(href="#")
| file-2-1-2
li
a(href="#")
| file-2-1-3
li
a(href="#")
| file-2-1
li
a(href="#")
| file-2-2
li
a(href="#")
| file-2-3
section.file
section.historic
a.version(href="#")
div.date
| 14:23:14
div.differences
| Différences
a.version(href="#")
div.date
| 14:24:01
div.differences
| Différences
a.version(href="#")
div.date
| 14:27:42
div.differences
| Différences
section.code
pre
| <html>
div(ng-controller="ApplicationController as hoy")
span
{{ hoy.pwet }}