Hi Guys I have a simple code using Bootstrap and AngularJS that I can't seem to work on. It will just show an alert once the button is clicked. Here is the code:
var myapp = angular.module('myapp',['ui.bootstrap']);
myapp.controller('mainCtrl', ['$scope',mainCtrl]);
function mainCtrl($scope) {
$scope.testing = function() {
alert("Button Is Pressed");
}
}
<!DOCTYPE html>
<html lang="en-US" data-ng-app="myapp">
<head>
<title>Sample Angular JS</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<script type='text/javascript' src='https://github.com/angular-ui/bootstrap/blob/gh-pages/ui-bootstrap-0.11.2.min.js'></script>
<script type='text/javascript' src='https://code.angularjs.org/1.3.0-rc.1/angular.min.js'></script>
<script type='text/javascript' src='myapp.js'></script>
</head>
<body data-ng-controller="mainCtrl">
<div class="container">
<button class="navbar-btn btn-danger btn pull-right" data-ng-click="testing()">Test</button>
</div>
</body>
</html>
I am not sure why the button is not working, could it be due to the library I am using? Please advise I am new to AngularJS framework. Thank you.
ui-bootstrap-0.11.2.min.jsshould be loaded afterangular.js