-1

This is my Json:

"review": {

{
"message_bar_text": "Please carefully review your transaction details. To make any changes after confirmation, please call <a ng-click=\"callCSC(number)\">1-800-325-6000</a>.
}

}

Here i am reading json to bind html:

WUAPI.getTranslateContent = function () {

 $timeout(function () {

        $http.get("translate/en_US.json").then(
          function (response) {
            $rootScope.getDefaultLocale = response.data;
          },
          function (error) {
            console.log(error);
          })
      });
    };

But i am unable bind ng-click element into HTML. The angular tags are completely removed when i am seeing the Html.

I am using ng-bind-html to read html tags(It's working fine) but i am unable to read angular tags. Please suggest me the solution

Petter Friberg
  • 21,252
  • 9
  • 60
  • 109

1 Answers1

-1

The asynchronous response of $http.get happens once the scope phase has finished. You wont see the update until the scope updates again.

Try triggering it manually once the http.get returns:

$http.get("translate/en_US.json").then(
    function (response) {
        $rootScope.getDefaultLocale = response.data;

        // Trigger a scope update
        if (!$scope.$$phase) 
        {
            $scope.$apply($rootScope.getDefaultLocale); 
        }
  },
  function (error) { console.log(error); });
PW123
  • 1