- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2016 10:45 AM
Hello. I'm trying to create an Angular Service Provider to share information amongst widgets. There seem to be a lot of examples of Directives, but I have not been able to find an example of an Angular Service Provider in Service Portal for ServiceNow (you can see how this might be a tough item to search for).
Being intrepid I tried it anyway, and went and created a new Angular Provider of type "Service", named it "breadcrumbServiceProvider", and added it to the Angular Provider related list on my widget.
The widget's client script declaration looks like this:
The error I get from the browser on load is:
js_includes_sp.jsx?v=05-03-2016_1034&lp=Wed_May_04_13_01_59_PDT_2016&c=11_202:11755 Error: [$injector:unpr] Unknown provider: breadcrumbServiceProvider <- breadcrumbService
The provider is configured thusly:
So the question is: how do you set up and inject a Widget Angular Service Provider?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2016 03:25 PM
Hi Jon,
If I'm not mistaken you have to provide the name of the Service Provider to your controller - in your case that should be breadcrumbServiceProvider instead of breadcrumb.
Just built a quick example (based on this tutorial) to try and show-case. Worked fine for me:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 05:36 AM
Angular Service Providers are essential in the design of a Service Portal, as they enable the definition and management of shared dependencies across various components. These providers allow for the creation of services that can be injected throughout the application, fostering reusability and modularity.
In a Service Portal, Angular Service Providers can be utilized to manage key functionalities like authentication, data retrieval, and user session management. By using these providers, you ensure that your Service Portal remains maintainable, scalable, and easy to test, with centralized logic that can be updated or modified without disrupting other parts of the application.
This method not only improves the efficiency of your Service Portal but also contributes to a more organized and cohesive codebase.