D
D
Denis Kharchenko2016-12-03 15:54:07
Angular
Denis Kharchenko, 2016-12-03 15:54:07

How to create a nav-bar with Routing on a component?

Good afternoon, colleagues.
There is a nav bar

<md-content class="md-padding">
    <md-nav-bar md-selected-nav-item="l.currentNavItem">
        <md-nav-item md-nav-sref="home" name="/home">Главная</md-nav-item>
        <md-nav-item md-nav-sref="contact" name="/contact">Контакты</md-nav-item>
        <md-nav-item md-nav-sref="about" name="/about">О нас</md-nav-item>
    </md-nav-bar>
    <div class="ext-content">
    </div>
</md-content>

(function () {
    "use strict";
    angular.module("layoutApp", ['ngMaterial', 'homeApp', 'contactApp', 'aboutApp' ])
})();

(function () {
    'use strict';
    angular.module('layoutApp')
        .component("layouttag",
        {
            controllerAs: "l",
            controller: [Layout],
            bindToController: true,
            templateUrl: "/App/layout/layout.html"
        });

    function Layout() {
        var l = this;
        l.$onInit = function () {
            l.currentNavItem = "/home"
        }
    }
})();

(function () {
    'use strict';
    angular.module('homeApp')
        .component("hometag",
        {
            controllerAs: "h",
            controller: [Home],
            templateUrl: "/App/home/home.html"
        });

    function Home() {
        var h = this;
    }
})();

(function () {
    'use strict';
    angular.module('contactApp')
        .component("contacttag",
        {
            controllerAs: "c",
            controller: [contact],
            templateUrl: "/App/contact/contact.html"
        });

    function Сontact() {
        var c = this;
    }
})();

(function () {
    'use strict';
    angular.module('aboutApp')
        .component("abouttag",
        {
            controllerAs: "a",
            controller: [About],
            templateUrl: "/App/about/about.html"
        });

    function About() {
        var a = this;
    }
})();

When switching, I wanted to switch to the component of the module. How to do it?
Thanks
Regards

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-12-04
@AMar4enko

https://ui-router.github.io/guide/ng1/route-to-com...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question