angularjs - How to inject provider in app config -


angular 1.6

i want register provider , use in app.config. error: [$injector:unpr] unknown provider error.

how inject provider correctly?

provider

class storage {    constructor () {     this.dashboards;   }    $get() {     return {       listdashboards: () => this.dashboards     };   }    savedashboards(dashboards) {     this.dashboards = dashboards;   }  }  export { storage }; 

module registering

import { storage } './services/storage.service.js';  const app = angular.module('dashboardapp', [     'ui.router',     'ui.bootstrap',     'gridster' ]) .provider('storageservice', storage);  app.config(function ($urlrouterprovider, $stateprovider, storageservice) {   storageservice // }; 

i tried register following ways, no success.

  1. .provider('storageservice', storage)
  2. .provider('storageservice', () => new storage())


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -