86
rated 0 times
[
90]
[
4]
/ answers: 1 / hits: 137581
/ 10 Years ago, sat, april 12, 2014, 12:00:00
I am trying just to display a div when user press a button, seems to be easy, but after spent a lot of time I am getting really crazy with this. My code is
My fiddle: http://jsfiddle.net/jmhostalet/4WK7R/1/
<div ng-app>
<div ng-controller=MyCtrl>
<div><button id=mybutton ng-click=showAlert()>Click me</button></div>
<div>Value: {{myvalue}}</div>
<div><div ng-show=myvalue class=hideByDefault>Here I am</div></div>
</div>
</div>
and my controller
function MyCtrl($scope) {
$scope.myvalue = false;
$scope.showAlert = function(){
$scope.myvalue = true;
};
}
Thank you!
More From » angularjs