Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

Uncategorized

Angular JS (1x) – Modify repeating rows table

Live coding demo below showing how to leverage a text box change even to modify the number of vertical rows.  Can easily step up/down by large numbers.   Demo and code below.

Cheers! 

shades_smile

Video

Angular JS (1x) – Modify repeating rows table from Jeff Jones on Vimeo.

Code

JS

function demoCtl ($scope) {
    var vm = $scope;
    vm.hello = 'world';

    //default
    vm.rowCount=2;
    vm.rows = [{name:'first'},{name:'second'}];

    //events
    vm.numberRowsChanged= function() {
        var gap = vm.rowCount - vm.rows.length;
        if (gap == 0) return;
        if (gap > 0) {
          // more
          for (var i = 0; i < gap; i++) {
            vm.rows.push({});
          }
        } else {
          // less
          for (var i = gap; i < 0; i++) {
            vm.rows.splice(-1, 1);
          }
        }
    };
}

angular.module('demoApp',[]).controller('demoCtl', demoCtl);

HTML

    
    
    
    Document
    
    



    

Total

Rows

VerifyAD – Validate Active Directory username and password with REST api

Below is a example of how to wrap System.DirectoryServices.AccountManagement.PrincipalContext.ValidateCredentials() with REST api container for electronic signature over REST api call.   This enables web based forms to be “signed” for business purpose with given user’s password.   The api will return “true” if given a valid Domain, User, and Password.   However, should any invalid input be given or an exception occur it merely responds “false.”

NOTE – This API should ONLY be used over HTTPS for secure encrypted transport.  Demo video shows HTTP for educational purposes only.

Cheers!  

shades_smile

Video

Code

References

Call SharePoint Online (SPO) REST api from AngularJS (1x) Lite Server with PNP.js

Video and code below demonstrate how to call SharePoint Online (SPO) REST api from a http://localhost JavaScript project.

Here we have a simple AngularJS 1x to-do list saving JSON payload data to a SharePoint Online list hosted in Office 365.   Authentication is achieved with EditThisCookie and ModHeader chrome extensions.  By exporting cookies from a valid Office 365 session to the “chromecors” session we are authenticated and enable to execute REST apis.    ModHeader is used for “Origin : tenant.sharepoint.com” to provide source detail.

Enjoy.  Cheers!  

shades_smile

Video

Code

Reference

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲