cordova - Pass a variable from controller to html in angularjs -
index.html
<div class="center" ng-controller="descriptioncontroller"> <p>{{perigrafi}}</p></div>
app.js
app.controller('descriptioncontroller', function($scope, datapassingservice) { $scope.description = datapassingservice.get(); var perigrafi = $scope.description.description_en; var onoma = $scope.description.name_en; alert("the description " + perigrafi); });
the datapassing service function passing data between controllers.the alert work perfect when try show perigrafi in html file not work suggestions? in advance.
well can directly use $scope.description object in html without creating new unnecessary variable
$scope.description.description_en // var perigrafi $scope.description.name_en; // var onoma
and in html can this
<p>{{description.description_en}}</p> <p>{{description.name_en}}</p>
Comments
Post a Comment