-1

ich mit AngularJS und ionischen meine Anwendung entwickle,Angular JS Inner Html für Ionic Rahmen

<div ng-app="myApp" ng-controller="myCtrl"> 

    <p ng-bind-html="{{itemID}}"></p> 

</div> 

Ich möchte dies wie innerHTML- zu AngularJS ändern,

<script> 
var app = angular.module("myApp", ['ngSanitize']); 
app.controller("myCtrl", function($scope) { 
    $scope.myText = "My name is:John Doe"; 
}); 
</script> 

Dies ist nicht, weil es muss statt $ scope.myText itemid schreiben.

Wie kann ich es einzigartig wie oben tun?

+0

Was möchten Sie tun –

+0

$ scope.myText = "Mein Name ist: John Doe"; – zafer

Antwort

0

löste ich das Problem. controller.js

$scope.myText={}; 


    var app = angular.module("myApp", ['ngSanitize']); 
    app.controller("myCtrl", function($scope,$itemID) { 
     $scope.myText{$itemID} = "My name is:John Doe"; 
    }); 

HTML-Seite

<div ng-app="myApp" ng-controller="myCtrl"> 
    <p ng-bind-html="myText[$itemID]"></p> 
</div> 
1

Aktualisieren Sie Ihren Code

<p ng-bind-html="myText"></p>