Skip to content

Instantly share code, notes, and snippets.

@rozanovz
Created April 15, 2016 18:40
Show Gist options
  • Select an option

  • Save rozanovz/1490c4cb00c916fdfa7d7ab24ea5a035 to your computer and use it in GitHub Desktop.

Select an option

Save rozanovz/1490c4cb00c916fdfa7d7ab24ea5a035 to your computer and use it in GitHub Desktop.
(function (){
angular.module('liraApp', ['ngRoute', 'ngSanitize']);
function config ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'home/home.view.html',
controller: 'homeCtrl',
controllerAs: 'home'
})
.when('/requirements', {
templateUrl: '/requirements/requirements.view.html',
controller: 'requirementsCtrl',
controllerAs: 'requirement'
})
.when('/new-:productType', {
templateUrl: '/orderCreate/orderCreate.view.html',
controller: 'orderCreateCtrl',
controllerAs: 'order'
})
.otherwise({redirectTo: '/'});
$locationProvider.html5Mode(true);
}
angular
.module('liraApp')
.config(['$routeProvider', '$locationProvider', config]);
})();
(function () {
angular
.module('liraApp')
.controller('orderCreateCtrl', orderCreateCtrl);
orderCreateCtrl.$inject = ['$routeParams', 'liraData', '$scope'];
function orderCreateCtrl( $routeParams, liraData, $scope ) {
var productType = $routeParams.productType;
$scope.pageHeader = {};
var loadData = function (productType) {
return liraData.products(productType).then(function(data){
$scope.pageHeader.title = 'Create new '+data.data[0].itemName;
}).catch(function(e){
console.log(e);
});
}
loadData(productType);
}
})();
<navigation></navigation>
<page-header content="pageHeader"></page-header>
<div class="container-fluid">
<footer-global></footer-global>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment