Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
133
rated 0 times [  134] [ 1]  / answers: 1 / hits: 7696  / 11 Years ago, thu, january 16, 2014, 12:00:00

HTML page in AngularJS.
My ng-show won't show div when boolean is set true.



This is my HTML file:



<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>




This is my controller.js file:



 // 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);
};
}]);


When i have console.log my booleanfil, it shows true(The value is changed)


More From » angularjs

 Answers
1

this:



this.editBoolean = editValue;


should be:



$scope.editBoolean = editValue;

[#48640] Wednesday, January 15, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
carlymykalac

Total Points: 740
Total Questions: 91
Total Answers: 91

Location: Sudan
Member since Thu, May 7, 2020
4 Years ago
carlymykalac questions
Fri, Dec 10, 21, 00:00, 3 Years ago
Mon, Sep 2, 19, 00:00, 5 Years ago
;