0

I'm using ng-show and ng-click to hide the login prompt of my application. The issue is my ng-click event isn't showing my form.

My html page

<div ng-if="config.getUser()!= null">
    Welcome {{config.getUser().username}} <span ng-click = "config.logout()">logout</span>
</div>
<div ng-if="config.getUser()== null">
    <button ng-click="show=true">login</button>
</div>
<div ng-show="show">
    <form name="login" id="login" ng-submit="config.loginUser(user)">
        <label for="login-username">Username</label> 
        <input ng-model="user.username" type="text" id="login-username"> 

        <label for="login-password">Password</label>
        <input ng-model="user.password" type="password" id="login-password"> 

        <input type="submit" value="Login">

        <p id="form-messages"></p>
    </form>
</div>
Matt Westlake
  • 3,499
  • 7
  • 39
  • 80
  • ng-if creates a child scope. [read this](http://stackoverflow.com/questions/14049480/what-are-the-nuances-of-scope-prototypal-prototypical-inheritance-in-angularjs) and follow dot rule. – PSL Jun 04 '15 at 21:44
  • @PSL thanks. didn't see where ng-if creates a new scope. – Matt Westlake Jun 04 '15 at 21:48
  • 1
    [see Directive Info section](https://docs.angularjs.org/api/ng/directive/ngIf) – PSL Jun 04 '15 at 21:50

0 Answers0