<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.2.9" data-semver="1.2.26" src="http://code.angularjs.org/1.2.26/angular.js"></script>
<script data-require="angular-ui-bootstrap@*" data-semver="0.11.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.11.0.min.js"></script>
<script data-require="angular-ui-router@0.2.7" data-semver="0.2.7" src="http://angular-ui.github.io/ui-router/release/angular-ui-router.js"></script>
<link data-require="bootstrap@*" data-semver="3.2.0" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css" />
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="app">
<div ui-view=""></div>
</body>
</html>
angular.module('app', ['ui.router', 'ui.bootstrap'])
.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('view', {
url: '',
template: '<button class="btn btn-default" ui-sref="modal"> Modal</button> <ui-view />',
controller: function($scope) {
}
})
.state('modal', {
//abstract: true,
parent: 'view',
url: '/modal',
onEnter: ['$modal', '$state', function($modal, $state) {
console.log('Open modal');
$modal.open({
template: '<button class="btn btn-danger" ui-sref="signin"> sign-in </button> <button ui-sref="signout" class="btn btn-success"> sign-out </button> <div ui-view="modal"></div>',
backdrop: false,
windowClass: 'right fade'
}).result.finally(function() {
$state.go('list');
});
}]
})
.state('signin', {
url: '/signin',
parent: 'modal',
views: {
'modal@': {
template: '<p>sign-in</p>'
}
}
})
.state('signout', {
url: '/signout',
parent: 'modal',
views: {
'modal@': {
template: '<p>sign-out</p>'
}
}
})
}]);
/* Styles go here */