Skip to content

Instantly share code, notes, and snippets.

@RadoMark
Created May 22, 2015 08:30
Show Gist options
  • Save RadoMark/64c23d3333137a976468 to your computer and use it in GitHub Desktop.
Save RadoMark/64c23d3333137a976468 to your computer and use it in GitHub Desktop.
Ui-router dynamic ui-sref
// Generated by CoffeeScript 1.9.1
(function() {
angular.module('myapp', ['ui.router'])
.config(['$stateProvider', function($stateProvider) {
$stateProvider
.state('test', {
url: '/test/:param',
views: {
'main': {
template: '<h1>Hello!!!</h1>'
}
}
});
}])
.run(['$rootScope', function($rootScope) {
}
])
.controller('TestCtrl', function($scope) {
$scope.state = 'test({param: 1})'
})
}).call(this);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" ng-app="myapp">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Title Goes Here</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.8/angular-ui-router.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.13/angular-ui-router.min.js"></script> -->
<script type="text/javascript" src="app.js"></script>
</head>
<body>
<div ng-controller="TestCtrl">
<a href ui-sref="{{state}}">TEST</a>
</div>
<div ui-view="main">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment