Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <html ng-controller="MainCtrl as main">
  2. <head>
  3. <title>{{ page.title() }}</title>
  4. ...
  5. </head>
  6. <body>
  7. <header>{{page.title()}}</header>
  8. <main ng-view></main>
  9. <footer></footer>
  10. </body>
  11. </html>
  12.  
  13. APP.controller('MainCtrl', function($scope, page, uri){
  14. $scope.page = page;
  15. $scope.uri = uri;
  16. });
  17.  
  18. APP.controller('ChatCtrl', function($scope, page, uri){
  19. uri.setActivePath('chat');
  20.  
  21. this.detailView = function(id){
  22. page.setPageTitle('Chat Controller - Detail view!!');
  23. $scope.chatID = id;
  24. }
  25.  
  26. this.listView = function(){
  27. page.setPageTitle('Chat Controller - List view!!');
  28. }
  29.  
  30. if(uri.segment(1)) this.detailView(uri.segment(1));
  31. else this.listView();
  32.  
  33. });
  34.  
  35. APP.factory('page', function(){
  36. var title = 'Hybrid Mobile Application';
  37.  
  38. return{
  39. title: function(){ return title; },
  40. setPageTitle: function(pageTitle){ title = pageTitle; }
  41. }
  42. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement