I have the following HTML:
<html lang="en" ng-app="MyApp">
<!--<other HTML elements> -->
<div ng-controller="nameController">
<div ng-show="{{name}}">
My Name
</div>
<span ng-click="showName()">Show Name</span>
</div>
<!--<other HTML elements> -->
And my angular controller looks like this:
var app = angular.module('MyApp', []);
app.controller('nameController', function($scope){
$scope.name = false;
$scope.showName = function()
{
$scope.name = true;
}
});
When I run this, "My Name" is hidden initially as expected, but clicking on Show does not display it. If I do console.log($scope.name)
then it displays true
I have been stuck with this for hours now...what am I doing wrong? Any help is very much appreciated..