i trying display data json object within controller's scope. happen within function calls ionic popup. trying display data in template used build popup itself. below function dwells within controller:
this.showalert = function(i) { this.pref = [{ label: "foo", addr_l1: "bar", addr_l2: "baz", locality: "pez" }]; var popup = '<p>dcd{{pickupctrl.pref[' + + '].addr_l1}}</p>' + '<p>{{pickupctrl.pref[' + + '].addr_l2}}</p>' + '<p>{{pickupctrl.pref[' + + '].locality}}</p>'; var alertpopup = $ionicpopup.alert({ title: this.pref[i].label, template: popup, buttons: [{ text: 'cancel' }, { text: '<b>ok</b>', type: 'button-positive', ontap: function(e) { // add choice } }, ] });
}
for reason, template not displaying angular expression, display "dcd" text added test. means there wrong in way calling expression itself.
how should specify variable within template displays?
the main problem forgot add scope: $scope
part of parameters ionic popup. from:
title: this.pref[i].label, template: popup, buttons: [{ text: 'cancel' }, { text: '<b>ok</b>', type: 'button-positive', ontap: function(e) { // add choice } }, ]
to this:
title: this.pref[i].label, template: popup, scope: $scope, // add buttons: [{ text: 'cancel' }, { text: '<b>ok</b>', type: 'button-positive', ontap: function(e) { // add choice } }, ]
Comments
Post a Comment