Skip to content

Instantly share code, notes, and snippets.

@renesansz
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save renesansz/6e52fd4098771eb9d92d to your computer and use it in GitHub Desktop.

Select an option

Save renesansz/6e52fd4098771eb9d92d to your computer and use it in GitHub Desktop.
Sample Code
.state('app.search', {
cache: false,
url: 'search?postal_code',
views: {
navContent: {
templateUrl: NG_PATH.MODULES + 'search/view.html',
controller: 'SearchController as vm'
}
}
})
/**
* Search Branch
*
* @param {Boolean} useLocation - Search using current location?
*/
function SearchBranch(useLocation) {
if (useLocation)
$state.go('app.search');
else
$state.go('app.search', { postal_code: vm.postalCode });
}
<form class="form-location" ng-submit="vm.SearchBranch()">
<div class="form-group">
<div class="row">
<div class="col col-67">
<input type="text" class="white-text input-text search-postcode" ng-model="vm.postalCode" placeholder="Enter postcode" required>
</div>
<div class="col">
<button class="button button-block button-light" type="submit">Go</button>
</div>
</div>
</div>
</form>
<button class="button button-block button-icon-top button-energized button-large submit-location" ng-click="vm.SearchBranch(true)"><span class="icon icon-marker-white"></span>Use current Location</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment