M
M
Maxim Ivanov2015-12-24 01:30:56
Angular
Maxim Ivanov, 2015-12-24 01:30:56

How to change ng-show state using AngularJS?

Before clicking the button, the section is shown and there is 1 in it. I want to click on the button so that this section is hidden, but it is not hidden, although its ng-show states change
before the click:
9c349bd8cb9948acb807b9c6e631c083.png
after the click:
48ab094898c64caf963df299816ea92d.png

<body ng-controller="UnitrackController as u">

  <section id="login" ng-model="u.login_visible" ng-show="{{u.login_visible}}">
                  1
                  <div ng-controller="UnitrackLogin as login">

                  <button ng-click="viewRegistration()">кнопка</button>
                 </div>

        </section>

</body>

app.controller('UnitrackController', function($scope){
this.login_visible = true;	
that = this
$scope.setLogin_visible = function(value){
  that.login_visible = value;
}

}).controller('UnitrackLogin', function($scope){
  $scope.viewRegistration = function(){
     $scope.setLogin_visible(false)
        }
});

Please tell me what I'm doing wrong, I want to keep the code structure the same

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2015-12-24
@omaxphp

ng-show="u.login_visible"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question