Created
December 23, 2013 09:01
-
-
Save purwandi/8093746 to your computer and use it in GitHub Desktop.
This file contains 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="app"> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<button ng-controller="MyController" ng-click="testing()" data-id="someCustomValue" data-name="Ketika merdeka"> | |
Press this button | |
</button> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script> | |
<script> | |
app = angular.module('app', []); | |
app.controller('MyController', function ($scope, $attrs) { | |
$scope.testing = function() { | |
alert($attrs.name); // console.log($attrs.id); // Prints 'someCustomValue' | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment