Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<div ng-controller="PageController">
<button value="Click to open modal" ng-click="openModal" />
<script type="text/template" id="myModalTemplate.html">
<h1>This is my modal popup template</h1>
<input type="text" ng-model="user.username" />
<input type="password" ng-model="user.password" />
<button ng-click="login" value="login" />
<script type="application/javascript">
// Step 1: Include ui.bootstrap module.
angular.module("ModalExampleApp", ["ui.bootstrap"])
.controller("PageController", function($scope, $uibModal) {
// In the controller that activates the modal (the activating controller), inject the $uibModal service.
// Activate the modal somehow (here, it's with a button).
controller: "ModalCtrl",
templateUrl: "myModalTemplate.html"
}).controller("ModalCtrl", function($uibModalInstance, $scope) {
$scope.user.username = "John";
$scope.user.password = "Test";
$scope.login = function() {
$"/myapp/login", $scope.user).then(function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment