first commit

This commit is contained in:
didier amyot committed 2014-12-13 18:03:08 -08:00
commit b2502bd29e
19 files changed
+556

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
define [
"angular"
"filters"
"services"
"directives"
"controllers"
"angularRoute"
], (angular, filters, services, directives, controllers) ->
# Declare app level module which depends on filters, and services
angular.module "myApp", [
"ngRoute"
"myApp.filters"
"myApp.services"
"myApp.directives"
"myApp.controllers"
]
@@ -0,0 +1,14 @@
define [], ->
[
"$scope"
"$http"
($scope, $http) ->
# You can access the scope of the controller from here
$scope.welcomeMessage = "hey this is myctrl2.js!"
# because this has happened asynchroneusly we've missed
# Angular's initial call to $apply after the controller has been loaded
# hence we need to explicityly call it at the end of our Controller constructor
$scope.$apply()
]
+14
View File
@@ -0,0 +1,14 @@
define [
"angular"
"services"
], (angular, services) ->
# Directives
angular.module("myApp.directives", ["myApp.services"]).directive "appVersion", [
"version"
(version) ->
return (scope, elm, attrs) ->
elm.text version
return
]
return
+32
View File
@@ -0,0 +1,32 @@
require.config
paths:
angular: "../bower_components/angular/angular"
angularRoute: "../bower_components/angular-route/angular-route"
angularMocks: "../bower_components/angular-mocks/angular-mocks"
text: "../bower_components/requirejs-text/text"
shim:
angular:
exports: "angular"
angularRoute: ["angular"]
angularMocks:
deps: ["angular"]
exports: "angular.mock"
priority: ["angular"]
#http://code.angularjs.org/1.2.1/docs/guide/bootstrap#overview_deferred-bootstrap
window.name = "NG_DEFER_BOOTSTRAP!"
require [
"angular"
"app"
"routes"
], (angular, app, routes) ->
$html = angular.element(document.getElementsByTagName("html")[0])
angular.element().ready ->
angular.resumeBootstrap [app["name"]]
return
return
+17
View File
@@ -0,0 +1,17 @@
define [
"angular"
"app"
], (angular, app) ->
app.config [
"$routeProvider"
($routeProvider) ->
$routeProvider.when "/view1",
templateUrl: "app/partials/partial1.html"
controller: "MyCtrl1"
$routeProvider.when "/view2",
templateUrl: "app/partials/partial2.html"
controller: "MyCtrl2"
$routeProvider.otherwise redirectTo: "/view1"
]
+8
View File
@@ -0,0 +1,8 @@
define ["angular"], (angular) ->
# Services
# Demonstrate how to register services
# In this case it is a simple value service.
angular.module("myApp.services", []).value "version", "0.1"
return
+34
View File
@@ -0,0 +1,34 @@
var bower = require('gulp-bower');
var gulp = require('gulp');
var coffee = require('gulp-coffee');
var help = require('gulp-task-listing');
var clean = require('gulp-clean');
gulp.task('help', help);
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest('bower_components/'))
});
gulp.task('coffee', function() {
gulp.src('app/coffee/**/*.coffee')
.pipe(coffee({bare: true}))
.pipe(gulp.dest('./app/js/'))
});
gulp.task('clean', function(){
return gulp.src(["js/", "bower_components/"], {read: false})
.pipe(clean())
});
gulp.task('default', ['bower', 'coffee']);
gulp.task('dev', ['bower', 'coffee'], function(){
gulp.watch('coffee/**/*.coffee', ['coffee']);
});
+33
View File
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Angular-RequireJS sample app</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="app/bower_components/html5-boilerplate/css/normalize.css">
<link rel="stylesheet" href="app/bower_components/html5-boilerplate/css/main.css">
<link rel="stylesheet" href="app/css/app.css"/>
<script src="app/bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<h1>AngularJS + RequireJS</h1>
<ul class="menu">
<li><a href="#/view1">view1</a></li>
<li><a href="#/view2">view2</a></li>
</ul>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div ng-view></div>
<div>AngularJS + RequireJS seed app: v<span app-version></span></div>
<script data-main="app/js/main" src="app/bower_components/requirejs/require.js"></script>
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
{
"dependencies": {
"gulp-task-listing": "~0.3.0",
"gulp-clean": "~0.3.1",
"gulp-coffee": "~2.2.0",
"gulp": "~3.8.9",
"gulp-bower": "0.0.7"
}
}