Guest User

Untitled

a guest
Dec 18th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. .directive("plunkerUserPane", ["collectionsManager", function(collectionsManager) {
  2.  
  3. var getAuth = function($http){
  4. $http.get('/user/auth').success(function(response) {
  5. if (response.isAuth) {
  6.  
  7. return 'user.html';
  8. } else {
  9. return 'userPane.html';
  10.  
  11. }
  12. });
  13. };
  14.  
  15. return {
  16. restrict: "E",
  17. replace: true,
  18. template: '<div ng-include src="userPane.getTemplate()"></div>',
  19. controllerAs: "userPane",
  20. controller: ["$scope", "$http", "login", "visitor", function($scope, $http, login, visitor) {
  21. this.visitor = visitor;
  22. this.getTemplate = function() {
  23. var template = 'userPane.html';
  24.  
  25. template = getAuth($http);
  26. return '/components/userPane/' + template;
  27. }
  28. this.showLoginWindow = function() {
  29. login.open();
  30. };
  31.  
  32.  
  33. }]
  34. };
  35. }])
Add Comment
Please, Sign In to add comment