0

In the master page n-bind-html is working but when calling view pages any data didnt get .

ng-bind-html="home.title" is working in the index header div.

index.html

             ....

             <title ng-bind-html="home.title"></title>

             ....

            <ng-view></ng-view>

contact.html but ng-view contact page ng-bind-html="home.title" not working and {{contact.info}} are not working.

            <h4 ng-bind-html="home.title"></h4>
            <p>{{contact.info}}</p>

controller:

    $scope.trustedHtml = function (plainText) {
        return $sce.trustAsHtml(plainText);
    }
    $http.get('admin/api/?s=getAbout&lang='+lang).success(
        function(r){
                $scope.about = r.text;
                //$scope.about = r.email;
        }
    );


    $http.get('admin/api/?s=getContact'+lang).success(
        function(r){
                $scope.contact = r;
                //$scope.contacttext.infoH = r[0].infoH;
                //$scope.contact.infoH = $sce.trustAsHtml(r.infoH); 

        }
    );


    $http.get('admin/api/?s=getHome&lang='+lang).success(
        function(r){
                $scope.home = r;
                $scope.home.address = $sce.trustAsHtml(r.address); 
                $scope.home.phone = $sce.trustAsHtml(r.phone); 
                $scope.home.email = $sce.trustAsHtml(r.email);
                $scope.home.title = $sce.trustAsHtml(r.title);                  
        }
    );

ng-view page of about is working . about.html

       <div class="container" style="font-size:16px;" ng-bind-html="trustedHtml(about)"></div>
1
  • post controller code, routes has different scope, if home.title is in the page scope can't be visible to the route scope Commented Jun 18, 2015 at 15:04

1 Answer 1

0

You need to add below code code for dynamically added element. See Here . Hope this helps:

AngularApp.run(function($rootScope, $location, $timeout) {
    $rootScope.$on('$viewContentLoaded', function() {
        $timeout(function() {
            componentHandler.upgradeAllRegistered();
        });
    });
});

How Component Handle works

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.