Friday, February 5, 2016

News ticker in SharePoint with AngularJS/RestAPI - Part 2

Hi all,

In my previous blog, have shown how to use news ticker in a page/master page.

Now i want to show one more type of active news ticker

Here the steps.

1. Create custom list named as "News" with two columns i.e. PageURL, HeadLines, IsActive.

2. Add few items to the list.




3. Now we want to show only active news headlines so we are changing RestAPI call as below,

var restUrl = _spPageContextInfo.webAbsoluteUrl+"/_api/web/lists/getbytitle('" + listTitle + "')/items?$filter=isActive eq 1";

As i told in the previous we can use the below snippet in a page or in master page.

Here the code snippet.



Here the final output..




Here the complete source code.


1 comment:

  1. Sir,

    There is an error on the line right after "li ng-repeat="item in books"

    It reads "a href="{{item.PageURL}}" target="_blank" {{item.HeadLines}}"

    IT should be replaced with "a href="{{item.PageURL.Url}}" in order for it to work...so just add .Url

    ReplyDelete