Last active
August 29, 2015 14:05
-
-
Save nateabele/c585cf4789b3154ce753 to your computer and use it in GitHub Desktop.
Angular Workshop Draft 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"from": "Nate", | |
"to": "Everybody", | |
"subject": "Doing a demo", | |
"body": "Hope I don't screw this up" | |
}, | |
{ | |
"from": "Everybody", | |
"to": "Nate", | |
"subject": "...", | |
"body": "Stop making syntax errors!" | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var SockDrawer = angular.module("sockdrawer", [ | |
'ui.bootstrap', | |
'ui.router', | |
'ur.model', | |
'ur.scaffold' | |
]); | |
SockDrawer.config(function($locationProvider, $stateProvider) { | |
$locationProvider.html5Mode(true); | |
$stateProvider.state("apps", { | |
url: "", | |
views: { | |
main: { | |
templateUrl: "/partials/apps.html" | |
} | |
} | |
}).state("apps.messages", { | |
url: "/messages", | |
resolve: { | |
messages: function($http) { | |
return $http.get("/api/messages").then(function(response) { | |
return response.data; | |
}); | |
} | |
}, | |
views: { | |
"main@": { | |
templateUrl: "/partials/messages.html", | |
controller: function($scope, messages, DataManager) { | |
console.log(DataManager.doSomething(2)); | |
$scope.messages = messages; | |
} | |
} | |
} | |
}).state("apps.photos", { | |
url: "/photos" | |
}).state("apps.files", { | |
url: "/files" | |
}); | |
}); | |
SockDrawer.run(function($state) { | |
$state.go("apps"); | |
}); | |
SockDrawer.controller("NavigationController", function($scope, $state) { | |
$scope.user = { name: "Nate" }; | |
}); | |
SockDrawer.service("DataManager", function() { | |
angular.extend(this, { | |
doSomething: function(val) { | |
return val++; | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app="sockdrawer"> | |
<head> | |
<base href="/" /> | |
<meta charset="utf-8" /> | |
<title>Sock Drawer</title> | |
<link rel="stylesheet" href="/css/app.css" /> | |
<!-- ref:js //cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js --> | |
<script src="/lib/lodash.js"></script> | |
<!-- endref --> | |
<!-- ref:js //cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.14/angular.min.js --> | |
<script src="/lib/angular-1.2.14/angular.js"></script> | |
<!-- endref --> | |
<!-- ref:js //cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.14/angular-animate.min.js --> | |
<script src="/lib/angular-1.2.14/angular-animate.js"></script> | |
<!-- endref --> | |
<!-- ref:js //cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.0/ui-bootstrap-tpls.min.js --> | |
<script src="/lib/angular-ui/ui-bootstrap-tpls-0.11.0.js"></script> | |
<!-- endref --> | |
<script src="/lib/angular-ui-router.js"></script> | |
<!-- ref:js js/lib.js --> | |
<script src="/lib/angular-model.js"></script> | |
<script src="/lib/angular-scaffold.js"></script> | |
<script src="/lib/angular-http-auth.js"></script> | |
<script src="/lib/moment/moment.js"></script> | |
<script src="/lib/moment/moment-timezone.js"></script> | |
<!-- endref --> | |
<!-- ref:js js/app.min.js --> | |
<script src="/js/base.js"></script> | |
<!-- endref --> | |
</head> | |
<body> | |
<div class="container"> | |
<header> | |
<nav class="navbar navbar-default" role="navigation" ng-controller="NavigationController"> | |
<div class="container-fluid"> | |
<div class="navbar-header"> | |
<a class="navbar-brand" href="/">Sock Drawer</a> | |
</div> | |
<div class="collapse navbar-collapse"> | |
<ul class="nav navbar-nav"> | |
<!-- Navigation --> | |
</ul> | |
<ul class="nav navbar-nav navbar-right"> | |
<li class="dropdown"> | |
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |
<span ng-bind="user.name">Account</span> | |
<span class="caret"></span> | |
</a> | |
<ul class="dropdown-menu" role="menu"> | |
<li><a href="#">Settings</a></li> | |
<li class="divider"></li> | |
<li><a href="#">Log out</a></li> | |
</ul> | |
</li> | |
</ul> | |
</div> | |
</div> | |
</nav> | |
</header> | |
<div class="main" ui-view="main"></div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div class="app-button"> | |
<a ui-sref="apps.messages" class="thumbnail"> | |
<span class="fa fa-paper-plane"></span> | |
<h3>Messages</h3> | |
</a> | |
</div> | |
<div class="app-button"> | |
<a ui-sref="apps.photos" class="thumbnail"> | |
<span class="fa fa-image"></span> | |
<h3>Photos</h3> | |
</a> | |
</div> | |
<div class="app-button"> | |
<a ui-sref="apps.files" class="thumbnail"> | |
<span class="fa fa-file"></span> | |
<h3>Files</h3> | |
</a> | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<li ng-repeat="message in messages"> | |
{{ message }} | |
</li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment