Posts

Showing posts with the label AngularJS

Get All Lists with REST API and AngularJS

Image
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>        <script>          var myAngApp = angular.module('SPAngGetLists', []);          myAngApp.controller('SPAngGetListsController', function ($scope, $http) {              $http({                  method: 'GET',                  url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists?$orderby=Title",                  headers: { "Accept": "application/json;odata=verbose" }              }).success(function (data, status, headers, config) {                  $scope.customers = data.d.results;              }).error(function (data, status, headers, config) {                          });          });  </script>  <div ng-app="SPAngGetLists">      <div ng-controller="SPAngGe

Show trusted HTML in AngularJS

angular.module('myAngApp.filters', []). filter("sanitize", ['$sce', function($sce) {   return function(htmlCode){     return $sce.trustAsHtml(htmlCode);   } }]);

Convert HTML into Plain Text in AngularJS

angular.module('myAngApp.filters', []).   filter('ConvertToPlainText', function() {     return function(text) {       return angular.element(text).text();     }   } );

Get all sites with REST API and AngularJS

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>        <script>          var myAngApp = angular.module('SPAngGetWeb', []);          myAngApp.controller('SPAngGetWebController', function ($scope, $http) {              $http({                  method: 'GET',                  url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/webs?$orderby=Title",                  headers: { "Accept": "application/json;odata=verbose" }              }).success(function (data, status, headers, config) {                  $scope.customers = data.d.results;              }).error(function (data, status, headers, config) {                          });          });  </script>  <div ng-app="SPAngGetWeb">      <div ng-controller="SPAngGetWebController" > 

List of All Site Templates with REST API and AngularJS

Here is the code which can show you how to display all site templates / custom templates with use of REST API & AngularJS in SharePoint : <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>        <script>          var myAngApp = angular.module('SPAngGetSiteTemplate', []);          myAngApp.controller('SPAngGetSiteTemplateController', function ($scope, $http) {              $http({                  method: 'GET',                  url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/getavailablewebtemplates(1033)?$orderby=Title",                  headers: { "Accept": "application/json;odata=verbose" }              }).success(function (data, status, headers, config) {                  $scope.customers = data.d.results;              }).error(function (data,