Skip to content

Instantly share code, notes, and snippets.

View icfantv's full-sized avatar

Adam Gordon icfantv

View GitHub Profile
@icfantv
icfantv / ISSUE_TEMPLATE.md
Created February 18, 2016 01:50
UIBS ISSUE_TEMPLATE.md

Uh oh! So you think you found an issue? We're so embarrassed. Prior to entering anything, please ensure you've read CONTRIBUTING.md as the issues forum is for bugs only and not for suppor-related requests. Support-related requests are best served by and for the community at large. Additionally, please note that we do not release patches for older versions of the library but we have provided some documentation history via the "Previous docs" dropdown on [our demo site] (http://angular-ui.github.io/bootstrap).

If you're upgrading from an older version of the library and you're experiencing console errors or other issues, please make sure you read through the CHANGELOG.md starting with the version from which you're upgrading. Pay particular attention to the breaking changes sections

@icfantv
icfantv / app.js
Created February 25, 2016 00:53
Angular HTTP Interceptors
var app = angular.module('app', []);
app.config(['$httpProvider', ConfigureInjectors]);
function ConfigureInjectors($httpProvider) {
$httpProvider.interceptors.push('InterceptorService');
}
app.service('InterceptorService', ['$cookie', InterceptorService]);
function InterceptorService($cookie) {
this.request = function(config) {
export class ExampleService {
static get $inject() {
return ['$http'];
}
constructor($http) {
this.$http = $http;
}
@icfantv
icfantv / BadPromise.js
Last active April 13, 2016 14:56
How to NOT do a nested promise
someFunction() {
// do some stuff
MyService.doSomething().then(() => {
// do some stuff
AnotherService.doSomethingElse().then((blah) => {
@icfantv
icfantv / structure.txt
Created March 18, 2016 16:38
Application Structure
Top Level Dir
index.html
app.js (or similar)
- dashboard
index.js
- controllers
DashboardController.js
...
- services
DashboardService.js
@icfantv
icfantv / app.js
Created March 22, 2016 23:37
Webpack FTW
import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap/dist/css/bootstrap-theme.css';
import 'font-awesome/css/font-awesome.css';
import 'angular-ui-tree/dist/angular-ui-tree.css';
import './main.css';
import angular from 'angular';
import ngAnimate from 'angular-animate';
import ngSanitize from 'angular-sanitize';
import ngRoute from 'angular-route';
@icfantv
icfantv / template.html
Last active March 24, 2016 16:07
Form Error Reporting in Angular
<ng-form name="shoeData">
<div class="container-fluid">
<div class="form-group col-sm-3 col-md-3 col-lg-3"
ng-class="{ 'has-error': shoeData.shoeName.$touched && shoeData.shoeName.$invalid }">
<label for="shoe-name" class="control-label">
Name: <span class="text-danger">*</span>
</label>
<input id="shoe-name"
type="text"
autocomplete="off"
@icfantv
icfantv / AlertService.es6
Last active March 31, 2016 19:20
Alert Service
import _remove from 'lodash/remove';
export class AlertService {
static get $inject() {
return ['$timeout', '$rootScope', 'UuidFactory'];
}
constructor($timeout, $rootScope, UuidFactory) {
this.$timeout = $timeout;
this.$rootScope = $rootScope;
@icfantv
icfantv / example.js
Created April 13, 2016 14:38
Preferred DI Structure
angular.module('app', [])
.controller('MyController', MyController);
function MyController($scope) {
}
MyController.$inject = ['$scope'];
@icfantv
icfantv / ScrollShadow.js
Created April 18, 2016 22:21
Angular Component
class ScrollShadowCtrl {
static get $inject() {
return ['$window', '$scope', '$elment'];
}
constructor($window, $scope, $element) {
this.$window = $window;
this.$element = $element;