Pages

Monday, April 20, 2015

How to display multiple apps on a single page in Sharepoint 2013 using angularjs

Manual Bootstrapping of angularjs

angular.bootstrap(document, ['<>'])
    
Define your app and modules
Sum:2+2 = {{2+2}}
Now you have to do the Manual Bootstrapping Note:you can define multiple apps on a page.

Define you app


    
    app.controller('module1', function ($scope,$http) {
    $http({
    method: 'GET',
    url: 'specifyurl',
    headers: {
    'Accept': 'application/json;odata=verbose'
    }
    }).success(function (data) { var result = data.d;}).error(function (data, status, headers, config) { });
    });
    
You should call angular.bootstrap() after you've loaded or defined your modules.
You cannot add controllers, services, directives, etc after an application bootstraps.

Bootstrap Angular

    
     angular.bootstrap(document.getElementById("app1",['module1']);
     
You should not use the ng-app directive when manually bootstrapping your app
Refrence