Skip to content

Instantly share code, notes, and snippets.

@rePassante
rePassante / controllers.js
Last active December 18, 2015 00:19
Polling In AngularJS
$scope.startPolling = function () {
$scope.isPolling = true;
$scope.pollCount = 60;
$scope.keepPolling();
};
$scope.stopPolling = function () {
$scope.isPolling = false;
$scope.pollCount = 60;
};
@rePassante
rePassante / main
Created June 3, 2013 03:07
AngularJS - Shared Data Services & Handling Page Refreshes
<!-- Check For Customer Data In sharedData -->
if (sharedData.getNewlyAddedCustomer() != null) {
<!-- The Data Exists In sharedData, add it to $scope and Proceed Normally -->
$scope.newlyAddedCustomerRequest = sharedData.getNewlyAddedCustomerRequest();
} else {
<!-- The Data DOES NOT Exist In sharedData, Let's check the hash and see if we can re-fetch -->
var path = $location.path();
var splitPath = path.split("/");
<!-- When we eval our split path we can eval to see if we have info after the route
if (splitPath.length > 2) {