first commit
This commit is contained in:
commit
b2502bd29e
19 files changed
+556
No files matched your search
@@ -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()
|
||||
]
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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"
|
||||
]
|
||||
@@ -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
|
||||
Reference in new issue
Block a user