2014-01-16 4 views
4

HTML 페이지가 AngularJS입니다. 부울을 true로 설정하면 내 ng-show에 div가 표시되지 않습니다.부울 값이 변경되면 AngularJS, ng-show가 작동하지 않습니다.

이 내 HTML 파일입니다

난 내 booleanfil을 CONSOLE.LOG 한
// Article controller 
wikiControllers.controller('articleController', ['$scope', 'articleService',  '$routeParams', '$sanitize', 
    function($scope, articleService, $routeParams, $sanitize){ 
$scope.editBoolean = false; 
$scope.edit = function(editValue){ 
    this.editBoolean = editValue; 
    console.log(this.editBoolean); 
}; 
    }]); 

는 사실을 보여줍니다 (: 이것은 내 controller.js 파일이

<div class="container"> 
<div ng-if="!query" ng-hide="editBoolean"> 
    <h3>{{article.id}} - {{article.title}}</h3> 
    <h4 ng-bind-html="article.text"></h4> 
    <button ng-click="edit(true)">Endre tekst</button> 
</div> 

<div ng-show="editBoolean"> 

    <style> 
    .ta-editor { 
     min-height: 300px; 
     height: auto; 
     overflow: auto; 
     font-family: inherit; 
     font-size: 100%; 
    } 
    </style> 

    <input type="text" ng-model="article.title" value="{{article.title}}"> 

    <div text-angular="text-angular" ng-model="article.text"></div> 
    <button ng-click="update(article.text, article.title)">Lagre</button> 
    <button ng-click="edit(false)">Avbryt</button> 

</div> 

<div ng-if="query"> 
    <h3>{{query}}</h3> 
</div> 

입니다 값이 변경됨)

+0

시도'$ scope.editBoolean = editValue' – putvande

+0

감사합니다! (와이) – user2925894

답변

6

this :

this.editBoolean = editValue; 

은 다음과 같아야합니다

+0

당신에게 선생님 감사했다

$scope.editBoolean = editValue; 
user2925894