Is there anyone who can assist me with the following question:
How do I access the "this" element within the ng-if (in my example, the classname is "class_to_obtain" of the span element)?
http://plnkr.co/edit/0s7PCWN2fJ8sJpFSJssV
HTML
<style>
.red
{
color:red;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="demoApp">
<div ng-controller="testCntr">
<span class="class_to_obtain" ng-if="test()">Test</span>
</div>
</body>
<script>
demoApp = angular.module('demoApp',[]);
demoApp.controller('testCntr', function ($scope)
{
$scope.test = function()
{
alert(this.className);
}
});
</script>
</html>