I was seeing if there is a way to call a function I designed inside the scope.
<ul class="ui-listview ui-radiobutton" ng-repeat="meter in meters"> <li class = "ui-divider"> {{meter.DESCRIPTION}} {{htmlgeneration}} </li> </ul> $scope.htmlgeneration = function() { blah blah }
The function is called htmlgeneration. Essentially what I want to do is dynamically append html inside the LI element while using angular.
To invoke this function in the html document, we have to create a simple button and using the onclick event attribute (which is an event handler) along with it, we can call the function by clicking on the button. In the above-given program, we have created a simple HTML document.
Try *ngIf="condition && yourfunction()" . Your function must return true to the if evaluate to true, but it will only be executed if your condition is true, since an and operator will stop on first false.
You can call your angularJS function from javascript or jquery with the help of angular. element().
Yep, just add parenthesis (calling the function). Make sure the function is in scope and actually returns something.
<ul class="ui-listview ui-radiobutton" ng-repeat="meter in meters"> <li class = "ui-divider"> {{ meter.DESCRIPTION }} {{ htmlgeneration() }} </li> </ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With