npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-contentful-service

v1.3.2

Published

[![GitHub release](https://img.shields.io/github/release/UseAllFive/angular-contentful-service.svg)]() [![GitHub license](https://img.shields.io/github/license/UseAllFive/angular-contentful-service.svg)](https://github.com/UseAllFive/angular-contentful-se

Downloads

7

Readme

GitHub release GitHub license GitHub issues Twitter

Angular Contentful Service

A contentful.js wrapper for Angular that makes our lives just a bit easier. Also, requests to the Contentful API are cached for improved performance!

Installation

Install with NPM

npm i --save angular-contentful-service

Install contentful

If you haven't already, make sure you install contentful

npm i --save contentful

Add to your app module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { ContentfulModule } from 'angular-contentful-service';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    ContentfulModule.forRoot({
      space: 'yadj1kx9rmg0', // your space ID
      accessToken: 'fdb4e7a3102747a02ea69ebac5e282b9e44d28fb340f778a4f5e788625a61abe', // your access token
    }),
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Use the Contentful Service

import { Component } from '@angular/core';
import { ContentfulService } from 'angular-contentful-service'

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {

  constructor(private cs: ContentfulService) {}

  getEntries(query?: any) {
    this.cs.getEntries(query).then(res => console.log(res));
  }

  getEntry(id: string, query?: any) {
    this.cs.getEntry(id, query).then(res => console.log(res));
  }
}

Configuration options

{
  space: string;
  accessToken: string;
  insecure?: boolean;
  host?: string;
  basePath?: string;
  httpAgent?: any;
  httpsAgent?: any;
  proxy?: {
    host: string;
    port?: number;
    auth?: {
      username: string;
      password: string;
    };
  };
  headers?: any;
  application?: string;
  integration?: string;
  resolveLinks?: boolean;
  retryOnError?: boolean;
}

Service methods

getEntries()

Return all entries filtered by Contentful query

getEntries(query?: any): Promise<EntryCollection<any>>

Information on EntryCollection type found here: https://github.com/contentful/contentful.js/blob/master/index.d.ts#L34

Example:

this.cs.getEntries({include: 2});

getEntry()

Return a single entry object based on id and optional query params

getEntry(id: string, query?: any): Promise<Entry<any>>

Information on Entry type found here: https://github.com/contentful/contentful.js/blob/master/index.d.ts#L65

Example:

this.cs.getEntry('3xd57HfJlSM2qmm8C6cueK', {include: 2})

Contribute

Please feel free to contribute to this repository. To do so, simply clone this repository and run ng serve to get the project working locally.

Brought to you by

Use All Five