Skip to content

Instantly share code, notes, and snippets.

@shanemgrey
shanemgrey / ngSearchBox.html
Created March 27, 2015 12:56
Search Box for AngularJS Using Bootstrap with List and Grid View Buttons
<!-- Full width search box with icons and actions associated to List and Grid Views -->
<!-- Requires Angular (1.3 used here), Bootstrap (3), and Font Awesome -->
<div class="row">
<div class="input-group m-b">
<span class="input-group-addon"><i class="fa fa-search"> </i></span>
<!-- auto-focus is a directive also found as a gist here. It sets the focus to an element on load. -->
<input class="form-control" auto-focus ng-init="$scope.searchQuery = $stateParams.query" type="text" minlength="3" maxlength="100" ng-model="searchQuery" placeholder="Search...">
<!-- List and Grid view buttons. Other elements watch listView and change as it does. -->
<!-- If using more than two states, this will need to be reworked. But it's easier as a boolean -->
<div class="input-group-addon">
@shanemgrey
shanemgrey / autoFocus.directive.js
Created March 27, 2015 14:01
Directive to focus element on page load
/**
* app.autoFocus Module
*
* Simple directive to focus the element whem DOM ready
*/
'use strict';
angular
.module('app.autoFocus', [])
.directive('autoFocus', function($timeout) {
@shanemgrey
shanemgrey / 0_reuse_code.js
Created December 27, 2016 23:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console