0

I need to inject content from a Factory into a Config but I know this isn't possible and is only possible if I use a provider instead, so please can anyone advise how to convert my factory into a Provider?

var templateApp = angular.module('templateApp', ['ngMaterial', 'ngRoute']);

templateApp.factory('pageFactory', function () {

    var pages = [
                {icon: 'assessment', name: 'Overview', route: '/partial1', template: 'View1.html'},
                {icon: 'assignment', name: 'Dashboard', route: '/partial2', template: 'View2.html'}
        ];

    var factory = {};
    factory.getPages = function(){
        return pages;
    }

    return factory;
});

Many thanks

Dom

georgeawg
  • 48,608
  • 13
  • 72
  • 95
DominicA
  • 45
  • 6
  • Possible duplicate of [AngularJS : What is a factory?](https://stackoverflow.com/questions/16596569/angularjs-what-is-a-factory) Look at the answers, that might explain what you need to do. – davidkonrad Dec 08 '18 at 04:24
  • Possible duplicate of [AngularJS: Service vs provider vs factory](https://stackoverflow.com/questions/15666048/angularjs-service-vs-provider-vs-factory). My [favorite answer](https://stackoverflow.com/a/33805462/5535245) has a nice picture of the relationship. – georgeawg Dec 08 '18 at 05:12
  • what do you want to expose during config phase? – felixmosh Dec 08 '18 at 09:40

0 Answers0