AngularJS: Exploring ng-bind-html, date formating, and filters

I have been intending to revisit Pocket Joe, in the near future.  When I do so, I want to include my social media feeds.  No matter how much I blog, I am always going to post to Twitter and Google+ more often.  So, how do you include your public Google+ feed in your app?

As you can see, this is very similar to the previous angular examples.  I used a YQL community table to get the data.  The query requires two things: an API key and what Google+ user you are querying.

Once you have the data from the web service, you just need to use ng-repeat to loop over the results.  This task has two curve balls in it, though.  The first one is the date value.  You need to use the date filter to format it in a user-friendly way.  The other issue is that you want to allow Angular to display the body of the post as HTML.  For that, I used ng-bind-html.

Have a question or comment?  Leave it below.

View in Plunker

Run in Plunker

View in jsFiddle

Run in jsFiddle

1 thought on “AngularJS: Exploring ng-bind-html, date formating, and filters

Leave a Reply to Yugal Sarkar Cancel reply

Your email address will not be published. Required fields are marked *