Socket
Socket
Sign inDemoInstall

angular-envelope

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
18.1 kB
Created
Weekly downloads
 

Readme

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

Last updated on 18 Jun 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc