0

im pulling in html from another site and it pulls in fine but i get this error in the console. this post is related to this post: Using AngularJS 1.2.16, unique issue with data escaping for href links

enter image description here

and this is my angular controller

var CapitalRequestMultiMillInquiryController = function ($scope, $rootScope, $modal, $window, $sce, CapitalRequestService, PlantService) {

$rootScope.title = 'Capital Request Multi Mill Inquiry';
$scope.allMills = [];
$scope.selectedMill = '';
$scope.jobNumber = '';
$scope.description = '';
$scope.amount = '';
$scope.amountOperator = '';
$scope.openOnly = '';
$scope.projectManager = '';

//$scope.allUsers = [];

//UsersService.getUsersWithId().then(function(objectTypes) {
//    $scope.allUsers = objectTypes
//});

//CapitalRequestService.searchMulti("http://tomcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
//    $scope.tomahawk = results;
//    for (var i = 0; i < $scope.tomahawk.length; i++)
//        $scope.tomahawk[i] = $sce.trustAsHTML($scope.tomahawk[i]);
//});


PlantService.getPlantId().then(function (mills) {
    $scope.allMills = mills
});

$scope.search = function() {
    //for each mill

    CapitalRequestService.searchMulti("http://coucmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
        $scope.counce = results;
    });
    CapitalRequestService.searchMulti("http://filcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
         $scope.filer = results;
     });
    CapitalRequestService.searchMulti("http://tomcmmsweb.pca.com/CapitalRequest/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
        $scope.tomahawk = results;
        for (var i = 0; i < $scope.tomahawk.length; i++)
            $scope.tomahawk[i] = $sce.trustAsHTML($scope.tomahawk[i]);
    });
    CapitalRequestService.searchMulti("http://tridentval.pca.com/api/Inquiry/Inquiry/CapitalRequestMultiMillInquiry/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
        $scope.valdosta = results;
    });
    CapitalRequestService.searchMulti("http://tridentder.pca.com/api/Inquiry/Inquiry/CapitalRequestMultiMillInquiry/Search", authenticatedUser.userName.toUpperCase(), $scope.selectedMill, $scope.jobNumber, $scope.description, $scope.amount, $scope.amountOperator, $scope.openOnly, $scope.projectManager).then(function (results) {
        $scope.deridder = results;
    });
}
};

and this is my html view

          <tbody>
                <tr ng-repeat="item in tomahawk">
                    <!--<td ng-bind-html="item.projectManager | addTargetBlank">{{item.projectManager}}</td>--><td></td>
                    <td ng-bind-html ="item.jobNumber | addTargetBlank"></td>
                    <td ng-bind-html ="item.description | addTargetBlank"></td>
                    <td ng-bind-html ="item.amount | addTargetBlank"></td>
                </tr>
                </tbody>
            </table>
        </accordion-group>
Community
  • 1
  • 1
Edgar
  • 543
  • 10
  • 20
  • You should convert your code into a snippet (snippet tool on question toolbar). It's neat and allows folks to play with your code. ;) – toddmo Jan 07 '16 at 20:28

1 Answers1

1

You have misspelled trustAsHtml.

As per the documentation here

trustAsHtml(value); Shorthand method. $sce.trustAsHtml(value) → $sceDelegate.trustAs($sce.HTML, value)

toddmo
  • 20,682
  • 14
  • 97
  • 107
  • i get this now: Error: [$sce:itype] Attempted to trust a non-string value in a content requiring a string: Context: html – Edgar Jan 07 '16 at 20:42
  • 1
    Well, can you mark this as the answer and post a new question? This site is not really an extended tech support back and forth but rather a q & a repository. But see http://stackoverflow.com/questions/31800589/sceitype-attempted-to-trust-a-non-string-value-in-a-content-requiring-a-string – toddmo Jan 07 '16 at 20:44