{"action":"created","issue":{"url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/199","repository_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter","labels_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/199/comments","events_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/199/events","html_url":"https://github.com/jadjoubran/laravel5-angular-material-starter/issues/199","id":140364175,"number":199,"title":"Update $scope after submit in directive","user":{"login":"vampire1306","id":8722389,"avatar_url":"https://avatars.githubusercontent.com/u/8722389?v=3","gravatar_id":"","url":"https://api.github.com/users/vampire1306","html_url":"https://github.com/vampire1306","followers_url":"https://api.github.com/users/vampire1306/followers","following_url":"https://api.github.com/users/vampire1306/following{/other_user}","gists_url":"https://api.github.com/users/vampire1306/gists{/gist_id}","starred_url":"https://api.github.com/users/vampire1306/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vampire1306/subscriptions","organizations_url":"https://api.github.com/users/vampire1306/orgs","repos_url":"https://api.github.com/users/vampire1306/repos","events_url":"https://api.github.com/users/vampire1306/events{/privacy}","received_events_url":"https://api.github.com/users/vampire1306/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/labels/Support","name":"Support","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-12T08:42:32Z","updated_at":"2016-03-14T21:02:06Z","closed_at":null,"body":"I want to hide the link Login in menu after the user successfully log in. So I user $scope.isLogin and ng-hide to do it.\r\nThe prolem is I can't change $scope.isLogin in my login directives, so the login link in menu is not hidden. except I press CTRL+F5 to completely reload the page :("},"comment":{"url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/comments/196520009","html_url":"https://github.com/jadjoubran/laravel5-angular-material-starter/issues/199#issuecomment-196520009","issue_url":"https://api.github.com/repos/jadjoubran/laravel5-angular-material-starter/issues/199","id":196520009,"user":{"login":"jadsalhani","id":6623311,"avatar_url":"https://avatars.githubusercontent.com/u/6623311?v=3","gravatar_id":"","url":"https://api.github.com/users/jadsalhani","html_url":"https://github.com/jadsalhani","followers_url":"https://api.github.com/users/jadsalhani/followers","following_url":"https://api.github.com/users/jadsalhani/following{/other_user}","gists_url":"https://api.github.com/users/jadsalhani/gists{/gist_id}","starred_url":"https://api.github.com/users/jadsalhani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jadsalhani/subscriptions","organizations_url":"https://api.github.com/users/jadsalhani/orgs","repos_url":"https://api.github.com/users/jadsalhani/repos","events_url":"https://api.github.com/users/jadsalhani/events{/privacy}","received_events_url":"https://api.github.com/users/jadsalhani/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T21:02:06Z","updated_at":"2016-03-14T21:02:06Z","body":"Hi @vampire1306 \r\n\r\nSo you have a couple of issues in your code that can be fixed (not sure they'll fix your issue, but better to fix them anyway)\r\n\r\n- If you want isLogin to be a variable expression, you don't have to use $scope. you can just declare it in the controller using `this.isLogin` and then use it in the html as `vm.isLogin`\r\nSo you'd have to fix that in your controllers and in the html of the sidenav and the login directive\r\n\r\n- To propagate data between 2 components/pages/controllers, the best practice is to use a service. So you can create something like\r\n``````\r\nexport class LoginService{\r\n    constructor(){\r\n       this.isLoggedIn = false\r\n    }\r\n\r\n   setLoggedIn(){\r\n       this.isLoggedIn = true;\r\n   }\r\n\r\n   getIsLoggedIn(){\r\n       return this.isLoggedIn;\r\n   }\r\n}\r\n``````\r\n\r\nAnd in your controller you'll have `this.$scope.isLogin = LoginService.getIsLoggedIn();` or `this.isLogin = LoginService.getIsLoggedIn();` if you fixed it as I said before.\r\n\r\nLet me know if this works for you"}}