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
//view <uib-timepicker ng-model="myModel.thing" ng-change="changed('whichModel',myModel.thing)" hour-step="timeConfig.hstep" minute-step="timeConfig.mstep" show-meridian="timeConfig.ismeridian"></uib-timepicker> | |
// controller | |
$scope.myModel ={}; | |
$scope.timeConfig = { | |
hstep:1, | |
mstep:1, | |
ismeridian:true | |
}; | |
$scope.changed = changed; |
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
//add as dependency | |
app.module('myApp',['findIndex']); | |
// inject into controller | |
app.module('myApp').controller('myController', function(IndexService) { | |
$scope.array[IndexService.getIndex($scope.array,'value to match in array',find this value)]; | |
}); | |
// service | |
angular.module('findIndex', []).factory('IndexService', function () { | |
return { | |
getIndex: function (arr,attr,val) { |
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
a.sort-link {color:#333} | |
a.sort-link:hover {cursor: pointer;text-decoration: none;color:#000} |
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
// fixes chosen updating for ng-options | |
angular.module('myApp', []).directive('chosen', function() { | |
var linker = function (scope, element, attrs) { | |
var list = attrs.chosen; | |
scope.$watch(list, function () { | |
element.trigger('chosen:updated'); | |
}); | |
scope.$watch(attrs.ngModel, function() { |
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
selectFullOfYears function() { | |
var now = new Date(), | |
year = now.getFullYear(); | |
return Array.from(Array(num)).map((e, i) => year + i); | |
} |
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
/* | |
https://github.com/harvesthq/chosen | |
https://github.com/localytics/angular-chosen | |
*/ | |
.chosen-container {width:100%!important} | |
.chosen-container-single .chosen-single { | |
background: #fff; | |
border: 1px solid #ccc; | |
border-radius: 4px; | |
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset; |
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
app.config(function ($routeProvider,$locationProvider) { | |
$routeProvider.when('/', { | |
templateUrl: 'views/main.html', | |
controller: 'MainCtrl', | |
title:'This Is The Page Title' | |
}).otherwise({ | |
redirectTo: '/' | |
}); | |
}).run(['$rootScope','$route','$location', function($rootScope,$route,$location) { | |
$rootScope.$on('$routeChangeSuccess', function() { |
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
// requires moment, usage: {{timeStampString | utcTime}} | |
angular.module("ctrl", []).filter('utcTime', function() { | |
return function (utcTime) { | |
if (!utcTime) { return ''; } | |
var newTime = moment(utcTime).utcOffset(-5).format('h:mm A'); | |
return newTime; | |
}; | |
}) |
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 <p>{{camelCaseStringOutput | uncamel}} | |
angular.module("ctrl", []).filter('uncamel', function() { | |
return function (uncamel) { | |
if (!uncamel) { return ''; } | |
var newValue = uncamel.replace(/([A-Z])/g, ' $1').replace(/^./, function(str){ | |
return str.toUpperCase(); | |
}); | |
return newValue; | |
}; |