Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-envelope

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-envelope

A wrapper for the AngularJS $http service to allow for simpler RESTful API transactions.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Angular Envelope

NPM version Build Status Coverage Status Known Vulnerabilities Downloads

A wrapper for the AngularJS $http service to allow for simpler RESTful API transactions.

Client-Side Usage

Include the script in your main template file:

<script src="/node_modules/angular-envelope/dist/envelope.js"></script>

Add the envelope dependency to the module you wish to use the service in, along with the Envelope service as a constructor argument:

angular.module("meme-central", ["envelope"])

.config(function($stateProvider) {
	$stateProvider.state("memes", {
		url: "/memes",
		templateUrl: "memes.html",
		controller: "MemesController",
		controllerAs: "memesController"
	});
})

.controller("MemesController", function(Envelope) {
	var self = this;

	Envelope.setBaseUrl("http://127.0.0.1:3000");

	self.memes = [];

	self.getMemes = function() {
		return Envelope.get(
			"memes",
			{
				categoryId: 420
			},
			{
				timeout: 6969,
				headers: {
					Authorization: "dnkroz"
				}
			},
			function(error, data, response) {
				if(error) {
					return console.error(error);
				}

				self.memes = data;
			}
		);
	};

	self.forcedMeme = function() {
		return Envelope.post(
			"memes",
			{
				title: "Uganda Knuckles",
				phrase: "u do not kno da wae."
			},
			{
				authorization: "idspispopd"
			},
			function(error, data, response) {
				if(error) {
					return console.error(error);
				}

				self.memes.push(data);
			}
		);
	};
});

Installation

To install this module:

npm install angular-envelope

Keywords

FAQs

Package last updated on 18 Jun 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc