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

@tilde-nlp/ngx-strapi

v6.0.2

Published

Simple library for communicating with Strapi CMS. Functions are mostly generic and library should not know nothing specific about business logic. It should implement only common methods that can be used in all projects that use strapi.

Downloads

95

Readme

NgxStrapi

Simple library for communicating with Strapi CMS. Functions are mostly generic and library should not know nothing specific about business logic. It should implement only common methods that can be used in all projects that use strapi.

StrapiApiService

Service for http communication with strapi.

StrapiService

Service for easier implementation with localizations for strapi single types and ngx-translate library. It listens to language changes and reads specific locale for active single types. Type is active when id from api is passed to activateSingleType method and it has not been deactivated. This kind of active/not active mechanism is implemented because you don't need to read all types any time when language changes because it is waste of resources. Type should be activated when strapi content is rendered (at components onInit method) and deactivated when it gets destroyed.

StrapiSubscriptionService

Service made for complex type strapi models. Use subscribeActivity method to subscribe for starpi service. subscribeActivity method returns Observable<T | null> which can be subscribed for initial values as well as language.

Usage example:

    { ... }
    constructor(public readonly strapiService: StarpiMenuService) {}

    // Create `Observable` to be subscribed
    const responseObs: Observable<T> = this.strapiSubscription
    .subscribeActivity<T>(CollectionTypes.MY_DATA, null);

    // Subscribe for data
    responseObs.subscribe((data: T) => this.myData = data)

To unsubscribe for value changes call unsubscribe method by providing the same input parameters.

StrapiHtmlComponent

Component meant for displaying content from strapi rich text in html format. Component modifies response html to make angular function as proper SPA.

  • It finds all <a> tags in html string and adds custom function on links click event. This function checks if links href includes origin href - if it does, it means that the route is inner route for application so it prevents default event on click and uses angular router to navigate to route without reloading app. If the link is from outside, proper navigation takes place.
  • Finds all <img> tags, loops through them and modifies image source. Window.location.origin gets replaced with strapi api url, so that images are loaded properly. By default, strapi returns image url without base url and angular automatically searches for image on its domain, not strapi api.

ProductPageBuilderComponent

Component is made for easy custom page creation with strapi. This allows for non-developers to create content in project. It also subscribes for language change and looks at strapi for translations.

Example

Add wildcard route with this component

{
  path: '**',
  component: ProductPageBuilderComponent
}

When no other route is found, angular creates instance of this component, who then looks in strapi for Custom-page type with specified route. If it is not found, it redirects to provided route for input parameter @Input() redirectRoute = "";.