Getting Started!
To get started you can simply clone the cidaas-sdk-angularjs repository and install the dependencies.
Prerequisites
You need git to clone the cidaas-sdk-js repository. You can get git from here
We also use a number of Node.js tools to initialize and test cidaas-sdk. You must have Node.js and its package manager (npm) installed. You can get them from here
Clone cidaas-sdk
Clone the cidaas-sdk-js repository using git:
git clone https://github.com/Cidaas/cidaas-sdk-angularjs.git
cd cidaas-sdk-angularjs
Install Dependencies
npm install
Run the Application
We have preconfigured the project with a simple development web server. The simplest way to start this server is:
npm start
Now browse to the app at localhost:5000/index.html
Directory Layout:
Usage
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope, $rootScope) {
$scope.username = ""
$scope.usernav = false;
$scope.nav = true;
$scope.Login = function () {
alert("angularjs");
doLogin();
}
$scope.Register = function () {
doRegister();
}
$scope.LogOut = function () {
doLogout(null, function () {
location.href = location.origin;
});
}
$scope.userinfocall = function (userinfo) {
$scope.usernav = true;
$scope.nav = false;
$scope.username = "Welcome "+userinfo.displayName
$scope.$digest();
}
});
</script>
For get user details simply call the userinfocall() funtion inside the cidaas.userinfo_callback() script method. The function call look like this, angular.element(document.querySelector('[ngcontroller="myCtrl"]')).scope().userinfocall(userinfo);
Events
The user trigger some events:
doLogin() - This method allows user login to your portal/domain.
doRegister() - This method allows user register to your portal/domain.
doLogout() - This method allows user logout from your protal/domain and the user session also closed from domain.
userinfocall(userinfo) - This method allows user get them information with this information they can display their details how they want.
configuration
Configuare your project into cidaas, you want the cidaas script. Click here to know more about getting the script