Reputation: 410
There is an HTML, which converts and displays the text in a container div
by filters:
<div ng-bind-html="message.message | hrefConvert | rawHtml | test"></div>
How I can add another object message.file
in ng-bind-html
, that to process by filter test
and return additional text in div
element?
Upvotes: 0
Views: 3922
Reputation: 6215
Try this:
<div ng-bind-html="message.message + message.file | hrefConvert | rawHtml | test"></div>
UPDATE:
I don't know the structure of the message.file
and the filter test
but you could prepare a function convertArrayToSrting
in your controller to convert the array to string:
$scope.convertArrayToSrting = function(fileArray){
var itemsConverted = [];
angular.forEach(fileArray, function(item){
this.push(item);
}, itemsConverted);
return itemsConverted.join();
}
<div ng-bind-html="message.message + convertArrayToSrting(message.file) | hrefConvert | rawHtml | test"></div>
Or.. You can use the filter test
in you controller to filter each element
$scope.convertArrayToSrting = function(){
var itemsConverted = [];
angular.forEach($scope.message.file, function(item){
this.push($filter('test')(item));
}, itemsConverted);
return itemsConverted.join();
}
<div ng-bind-html="message.message + convertArrayToSrting() | hrefConvert | rawHtml"></div>
For a better answer you could show the code of your filter test
and the object message.file
Upvotes: 1