Can't call function


I’m putting together a ionicPopup and within your content, I need to make a call to a function. The problem is that not called me and read as undefined function. I leave my code.

$scope.verInfo = function(marker,marker){
   title: 'Información View',
   subTitle: '',
   content: '<i class="'+marker.icono+' ver_view-1" id="icono_like" ng-cloak ng-click='+$scope.darLike('><span>''</span></i>',
   buttons: [
    { text: 'Salir',
            onTap: function(e){
       text: 'Ver Detalle',
       type: 'button-positive',
       onTap: function(e) {

It’s a bit messy because the content is pure html. but $ scope.darLike function is not working, is not declared when inspecting items within the popup.


Try ng-click='darLike(' instead.


Still not working …

That’s what you get :

<i class="icon ion-android-favorite-outline ver_view-1" id="icono_like" ng-click="undefined"><span>2</span></i>


If the function is called $scope.darLike you need ng-click to have darLike as a string in the ng-click, but needs to be taken from the javascript, so something like this:

ng-click="darLike(' + + ')"

and you need to pass scope to the popup

    title: 'Información View',
    subTitle: '',
    content: contentHtml,
    scope: $scope,

Codepen example:


:blush: thank you! it works great for me!