This file contains 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
angular.module('app', []) | |
.controller('AppCtrl', function(){ | |
var app = this; | |
app.names = [ | |
{ | |
"id": "e1", | |
"firstName": "Alyson", | |
"lastName": "Valdez" | |
}, | |
{ |
This file contains 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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
.columns{border-bottom:1px solid pink} | |
/** | |
This scss component assumes foundation is being used. | |
**/ | |
label.inline-compact, |
This file contains 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
angular | |
.module("app", []) | |
.factory("MyModel", MyModelFactory) | |
.controller("AppController", AppController); | |
function MyModelFactory($http){ // | |
var url = "/my-service"; | |
var originalData; | |
var service = { | |
data : [], //assumes data is a collection of same object |
This file contains 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
//usage | |
//minutesToHours(60) = '1:00' | |
//minutesToHours(45) = '0:45' | |
//minutesToHours(43) = '0:45' rounds to nearest 15 | |
function minutesToHours(minutes){ | |
var isNegative = (minutes < 0); | |
var absMinutes = Math.abs(minutes); //if negative convert to positive | |
var dividedBy60 = (absMinutes / 60); | |
var roundedHour = Math.floor(dividedBy60); |
This file contains 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
(function(){ | |
"use strict"; | |
/** | |
* Hijacks the ui-router $state.transitionTo() method to capture it's promise. | |
* the promise is added to the $state as $promise (may or may not be needed); | |
* also adds handler for rejection of the $promise. | |
*/ | |
angular |
This file contains 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
/** | |
* Similar to the idea of adding 'rules' to a states data object, I add injectible | |
* handlers keyed to the specific stateChange relationship: | |
* | |
* 'onToStateChangeStart/Success' - fired when the state is the destination | |
* 'onFromStateChangeStart/Success' - fired when the state is the previous | |
* | |
* I like this because the we can run all handlers through one event binding | |
* and make the state definition object for self-contained. | |
**/ |
This file contains 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
module.directive('staticInclude', ["$http", "$templateCache", "$compile", "$parse",function($http, $templateCache, $compile, $parse) { | |
return function(scope, element, attrs) { | |
var templatePath = $parse(attrs.staticInclude)(scope); | |
attrs.$observe("staticInclude", function(value){ | |
scope.$watch(value, function(templatePath){ | |
loadTemplate(templatePath); | |
}); |
This file contains 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
//Pseudo Code | |
it(" should have a scrollbar", function(){ | |
var tableWrap, table, tablePosTop, newTablePosTop; | |
tableWrap = $(".tableWrapper"); | |
table = tableWrap.find("table"); | |
tablePosTop = table.position().top; | |
tableWrap.animate({scrollTop:100},0); | |
newTablePosTop = table.position().top; |
This file contains 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
beforeEach(inject(function( _$document_){ | |
$document = _$document_; | |
$document.find("head").append( | |
"<style>\ | |
table{width:100%}\ | |
</style>" | |
); | |
})); |