Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created August 29, 2016 15:38
Show Gist options
  • Save n8finch/a5ad58f0e2020f2b96ca6e12464d04aa to your computer and use it in GitHub Desktop.
Save n8finch/a5ad58f0e2020f2b96ca6e12464d04aa to your computer and use it in GitHub Desktop.
adding-filter-to-rendered-posts.js
(function (angular) {
'use strict';
angular.module('myApp', [])
.controller('example', ['$scope', '$http', function ($scope, $http) {
$http({
url: 'https://n8finch.dev/wp-json/wp/v2/posts',
cache: true
}).success(function (res) {
$scope.posts = res;
console.log($scope.posts);
});
}])
.filter('to_trusted', ['$sce', function ($sce) {
return function (text) {
return $sce.trustAsHtml(text);
};
}]);
})(window.angular);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment