Skip to content

Instantly share code, notes, and snippets.

@gmittica
Created October 3, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmittica/a2893e6cc57b4ed63eae4c4839f1c734 to your computer and use it in GitHub Desktop.
Save gmittica/a2893e6cc57b4ed63eae4c4839f1c734 to your computer and use it in GitHub Desktop.
Angular Lesson // source http://jsbin.com/pumojig
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"></script>
<script src="http://unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Angular Lesson</title>
<style id="jsbin-css">
body > .container {
margin-top:20px;
}
</style>
</head>
<body ng-app="myApp">
<div class="container" >
<div class="well">
<a class="btn btn-link" ui-sref="home">Home</a>
<a class="btn btn-link" ui-sref="about({'name': 'Joker'})">About</a>
</div>
<ui-view></ui-view>
</div>
<script id="jsbin-javascript">
angular.module("myApp", ['ui.router'])
.controller("firstCtrl", function($scope, $stateParams) {
$scope.name = $stateParams.name;
})
.config(function($stateProvider) {
var helloState = {
name: 'home',
url: '/home',
template: '<h3>This is the home</h3>'
}
var aboutState = {
name: 'about',
url: '/about/:name',
template: '<h3>Hi {{ name}}</h3>',
controller: 'firstCtrl'
}
$stateProvider.state(helloState);
$stateProvider.state(aboutState);
});
;
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"><\/script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"><\/script>
<script src="https://rawgit.com/angular/bower-angular/master/angular.min.js"><\/script>
<script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"><\/script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Angular Lesson</title>
</head>
<body ng-app="myApp">
<div class="container" >
<div class="well">
<a class="btn btn-link" ui-sref="home">Home</a>
<a class="btn btn-link" ui-sref="about({'name': 'Joker'})">About</a>
</div>
<ui-view></ui-view>
</div>
</body>
</html>
</script>
<script id="jsbin-source-css" type="text/css">body > .container {
margin-top:20px;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">angular.module("myApp", ['ui.router'])
.controller("firstCtrl", function($scope, $stateParams) {
$scope.name = $stateParams.name;
})
.config(function($stateProvider) {
var helloState = {
name: 'home',
url: '/home',
template: '<h3>This is the home</h3>'
}
var aboutState = {
name: 'about',
url: '/about/:name',
template: '<h3>Hi {{ name}}</h3>',
controller: 'firstCtrl'
}
$stateProvider.state(helloState);
$stateProvider.state(aboutState);
});
;</script></body>
</html>
body > .container {
margin-top:20px;
}
angular.module("myApp", ['ui.router'])
.controller("firstCtrl", function($scope, $stateParams) {
$scope.name = $stateParams.name;
})
.config(function($stateProvider) {
var helloState = {
name: 'home',
url: '/home',
template: '<h3>This is the home</h3>'
}
var aboutState = {
name: 'about',
url: '/about/:name',
template: '<h3>Hi {{ name}}</h3>',
controller: 'firstCtrl'
}
$stateProvider.state(helloState);
$stateProvider.state(aboutState);
});
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment