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
<div class="form-group" | |
data-ng-class="{'has-error': options.validation.errorExistsAndShouldBeVisible}"> | |
<label for="{{ ::id }}" class="control-label"> | |
{{ ::to.label }} | |
<span data-ng-if="::to.required" class="text-red">*</span> | |
</label> | |
<formly-transclude></formly-transclude> | |
<div class="my-messages" data-my-messages="options"></div> | |
</div> |
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
define(['angular-animate', | |
'angular-messages'], function() { | |
'use strict'; | |
var app = angular.module('my-module', [ | |
'ngRoute', | |
'ngAnimate', | |
'ngMessages']); | |
app.config(['$logProvider', '$routeProvider', 'DashboardConstants', InitializeRouteProvider]); | |
app.config(['$httpProvider', InitializeHttpProvider]); |
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
var app = angular.module('app', []); | |
app.service('MyHttpService', ['$http', MyHttpService]); | |
function MyHttpService($http) { | |
this.doHttpCall = function() { | |
return $http.get('/foo.json'); | |
}; | |
} | |
app.service('MyService', ['$q', MyService]); |
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.controller('FormlyMultiCheckboxController', ['$scope', FormlyMultiCheckboxController]); | |
function FormlyMultiCheckboxController($scope) { | |
var to = $scope.to; | |
var opts = $scope.options; | |
$scope.multiCheckbox = { | |
checked: [], | |
change: setModel, | |
selectAll: false, | |
toggleSelectAll: toggleSelectAll |
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.service('AuthService', function($q, $http) { | |
var authStuff, promise; | |
this.login = function(credentials) { | |
if (!authStuff) { | |
promise = $http.post(...).then(function(response) { authStuff = response.data; }); | |
} | |
return $q(function(resolve, reject) { |
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 ModalController($scope, $uibModalInstance) { | |
$scope.data = {}; | |
$scope.data.form = {}; | |
$scope.close = function() { | |
$uibModalInstace.close($scope.data.form); | |
} | |
$scope.cancel = 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
vm.username = function($viewValue, $modelValue, scope) { | |
// check if username matches regex before validating | |
var value = $modelValue || $viewValue, deferred = $q.defer(); | |
if (UserConfig.ID_REGEX.test(value)) { | |
scope.options.templateOptions.loading = true; | |
UserService.username(value).then(function() { | |
deferred.reject(false); |
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
export function MyDirective() { | |
return { | |
restrict: 'E', | |
controller: 'MyDirectiveController', | |
controllerAs: 'snoopy', | |
scope: { | |
stuff: '=yoGimmeSomeStuff' | |
}, | |
templateUrl: 'components/snoopy/views/gimme-some-stuff-template.html' | |
}; |
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
export function SampleRouteConfiguration($routeProvider) { | |
$routeProvider.when('/customer', { | |
controller: 'CustomerListController', | |
controllerAs: 'customers', | |
templateUrl: 'path/to/customers.html', | |
resolve: { | |
consumers: ['CustomerService', CustomerService => CustomerService.getAll()] | |
} | |
}).when('/customer/:id', { | |
controller: 'CustomerController', |