Created
April 5, 2012 07:46
-
-
Save mathiasverraes/2308833 to your computer and use it in GitHub Desktop.
angluar + keymaster + $location
This file contains hidden or 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
<!doctype html> | |
<html ng-app> | |
<script src="http://code.angularjs.org/angular-1.0.0rc3.min.js"></script> | |
<script src="https://raw.github.com/madrobby/keymaster/master/keymaster.min.js"></script> | |
<script> | |
function HelloCntl($scope, $location) { | |
$scope.name = 'World'; | |
$location.path('/foo'); | |
key('x', function() { | |
console.log('x key pressed'); | |
$location.path('/bar'); // problem: location doesn't change | |
}); | |
} | |
</script> | |
<body> | |
<div ng-controller="HelloCntl"> | |
Hello {{name}}! | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment