To install this package in your AngularJS app run:
bower install missionhub-js
angular
.module('missionhub', ['missionhub.api']);
angular
.module('missionhub')
.config(config);
/** @ngInject */
function config(apiProvider) {
apiProvider.baseUrl = 'https://stage.missionhub.com/apis/v4';
}
function MyController(api, userDetails) {
var vm = this;
vm.userDetails = userDetails;
activate();
function activate() {
api.organizations.get().then(function(data){
console.log('orgs:', data);
});
}
}
userDetails.getFirstName()
userDetails.setFirstName(value)
userDetails.getLastName()
userDetails.setLastName(value)
userDetails.getPersonId()
userDetails.setPersonId(value)
userDetails.getProfilePicture()
userDetails.setProfilePicture(value)
userDetails.getCurrentOrganization()
userDetails.setCurrentOrganization(value)
userDetails.clearAll()
Return all organizations that the user has access to.
api.organizations.all()
.then(function(response){
//response contains an array of organization objects
});
[
{
"id": 8953,
"name": "Test",
"terminology": "Organization",
"ancestry": null,
"show_sub_orgs": true,
"status": "active",
"created_at": "2015-10-20T12:05:11-03:00",
"updated_at": "2015-10-20T12:05:11-03:00"
}
]
Return the current organization. Current organization id is loaded from userDetails.getCurrentOrganization()
api.organizations.current()
.then(function(response){
//response contains the organization object
});
{
"id": 8953,
"name": "Test",
"terminology": "Organization",
"ancestry": null,
"show_sub_orgs": true,
"status": "active",
"created_at": "2015-10-20T12:05:11-03:00",
"updated_at": "2015-10-20T12:05:11-03:00"
}
- Install NodeJS. This will vary depending on your Operating System.
- Clone this repo and open a terminal in that folder.
- Run
npm install
to install the command line tools. - Run
bower install
to install the web app dependencies. - Run
gulp
. This command will build the project and output js files to/dist
.
To develop locally with the missionhub-js package and have your project use these local files you can use bower link
.
- In this local copy of missionhub-js, run
bower link
to create a global link to this package - Then in your project, run
bower link missionhub-js
to symlink/bower_components/missionhub-js
to this local package