🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

angular-http-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-http-api

An AngularJS HTTP API Service for making paramerterized HTTP calls and getting back useful data structures.

0.0.2
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Angular HTTP API

Coverage Status Build Status Dependency Status NPM version

The purpose of this library is to provide a very light API for making parameterized URL requests to an API server.

Installation

npm install angular-http-api
# or
bower install angular-http-api

Usage

var app = angular.module('testApp', ['httpApi']);

app.config(function (httpApiProvider) {
  httpApiProvider.setHost('google.com');
  httpApiProvider.preferScheme('https');
});

app.factory('UserService', function (httpApi) {
  return {
    lookupUser: function (email) {
      httpApi.get('/user/:email', {email: email});
    },
    searchUser: function (name) {
      httpApi.get('/user/search', {}, {firstName: name});
    }
  };
});

app.controller('testCtrl', function (UserService) {
  $scope.user;
  $scope.matching = [];

  UserService.lookupUser('petermelias@gmail.com').then(function (user) {
    $scope.user = user;
  });
  // GET: https://google.com/user/petermelias@gmail.com

  UserService.searchUser('Peter').then(function (matches) {
    $scope.matching = matches;
  });
  // GET: https://google.com/user/search?firstName=peter
});

License

MIT

Keywords

angularjs

FAQs

Package last updated on 09 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts