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
| app.directive('maskTel', function() { | |
| return { | |
| require: 'ngModel', | |
| link: function(scope, element, attrs, ngModel) { | |
| var maskTel = function(inputValue) { | |
| if(inputValue) { | |
| var masked = null, | |
| s = inputValue.replace(/\D/g, '').slice(0,10); | |
| ngModel.$setValidity('tel', false); |
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
| .custom-select { | |
| background: @white url(/images/dropdown.jpg) right center no-repeat; | |
| border: 1px solid @grey_light_border; | |
| color: @textcolor; | |
| padding: 0 0 0 20px !important; | |
| height: 44px; | |
| line-height: 43px; | |
| overflow: hidden; | |
| select { | |
| background: transparent; |
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
| app.directive('empty', function() { | |
| return { | |
| restrict: 'A', | |
| require: '?ngModel', | |
| priority: 0, | |
| link: function(scope, elem, attrs, ngModel) { | |
| if(!ngModel) return; // do nothing if no ng-model | |
| // watch own value and re-validate on change | |
| scope.$watch(attrs.ngModel, function() { |
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
| bolster.factory('Proxy', ['$http', function($http) { | |
| return { | |
| Request: function(verb, action, url, data, ok, error, fault) { | |
| // callback handlers | |
| var handleOk = function(data, ok) { | |
| if(ok) return ok(); | |
| //default function | |
| console.log(data); | |
| } |
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
| { | |
| request: function(obj) { | |
| // callback handlers | |
| var handleOk = function(response, ok) { | |
| console.log('ok: ', data.data); | |
| return response.data; | |
| } | |
| $http(obj).success(function(response) { | |
| if(response.status === 'ok') handleOk(response, ok); |
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
| app.factory('Proxy', ['$http', '$q', function($http, $q) { | |
| return { | |
| errorMessage: null, | |
| request: function(method, action, url, data) { | |
| var deferred = $q.defer(), | |
| me = this; | |
| // core functionality | |
| if(method === 'get') { | |
| var obj = { |
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
| var app = angular.module('app', ['ngAnimate', 'ngProgress']); | |
| app.config(['$httpProvider', 'ngProgress', function($httpProvider, ngProgress) { | |
| $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; | |
| $httpProvider.defaults.transformRequest = [function(data){ return data != undefined ? $.param(data) : null; }]; | |
| $httpProvider.responseInterceptors.push('ProgressBar'); | |
| $httpProvider.defaults.transformRequest.push(function(data) { | |
| // start the progress bar | |
| ngProgress.start(); | |
| return data; |
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
| var blur = function() { | |
| return { | |
| restrict: 'A', | |
| require: '?ngModel', | |
| link: function (scope, element, attrs, ngModel) { | |
| if(!ngModel) return; | |
| ngModel.$setValidity('blur', true); | |
| var validator = function(value) { | |
| if(ngModel.$invalid) { |
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
| getSummary: function() { | |
| var i = 0, | |
| l = this.data.length, | |
| titles = []; | |
| for(i; i < l; i++) { | |
| var obj = { | |
| id: this.data[i].id, | |
| name: this.data[i].name, | |
| slug: Slugify(this.data[i].name) |
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
| app.service('Model', ['$q', '$http', function($q, $http) { | |
| this.find = function(id) { // generic method for looking up data in the client-side model | |
| return this.data[id]; | |
| } | |
| this.fetch = function(resource, id) { // generic CRUD method | |
| this.data = $http.get(resource, id); | |
| } | |
| }]); | |
| app.factory('Cars', ['Model', function(Model) { |