Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html ng-controller="MainCtrl as main">
- <head>
- <title>{{ page.title() }}</title>
- ...
- </head>
- <body>
- <header>{{page.title()}}</header>
- <main ng-view></main>
- <footer></footer>
- </body>
- </html>
- APP.controller('MainCtrl', function($scope, page, uri){
- $scope.page = page;
- $scope.uri = uri;
- });
- APP.controller('ChatCtrl', function($scope, page, uri){
- uri.setActivePath('chat');
- this.detailView = function(id){
- page.setPageTitle('Chat Controller - Detail view!!');
- $scope.chatID = id;
- }
- this.listView = function(){
- page.setPageTitle('Chat Controller - List view!!');
- }
- if(uri.segment(1)) this.detailView(uri.segment(1));
- else this.listView();
- });
- APP.factory('page', function(){
- var title = 'Hybrid Mobile Application';
- return{
- title: function(){ return title; },
- setPageTitle: function(pageTitle){ title = pageTitle; }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement