Angular New Router is now ngComponentRouter. What's the equivilant for $componentLoaderProvider

621 views Asked by At

Does anyone know the new ngComponentRouter equivilant for $componentLoaderProvider to tell the router where to find the views. I have a home component located off the root of the application in

app/components/home/home.html along with the following home.js

(function () {
        'use strict';
        angular.module('formbuilder.pages')
            .directive('home', directive);

        directive.$inject = ['$log'];

        // configure subroutes
        directive.$routeConfig = [
            {
                path: '/',
                component: 'welcome',
                as: 'Welcome'
            }
        ];
        function directive($log) {
            return {
                templateUrl: 'app/components/home/home.html', <-- thought this wasn't needed
                controller: controller,
                controllerAs: 'home'
            }
        }

        controller.$inject = ['$router'];

        function controller($router) {
            var vm = angular.extend(this, {
                samplefunction: samplefunction
            });

            vm.text = 'Form Builder v.1';

            function samplefunction() {
                // handle mobile view 
                alert("click me controller function");
            }
        }
})();

In the above templateUrl: 'app/components/home/home.html', I thought was supposed to be able to be left out.

previous versions of documentation show

.config(['$componentLoaderProvider', function($componentLoaderProvider){
$componentLoaderProvider.setTemplateMapping(function (name) {
  return 'parallel/components/' + name + '/' + name + '.html';
});

however it is throwing an error on $componentLoaderProvider and after doing a search through the angular_1_router.js file I can find no such provider... does anyone know how to tell ngComponentRouter where to find the template views for a component?

0

There are 0 answers