A
A
Alexey Belov2018-02-21 13:20:28
Angular
Alexey Belov, 2018-02-21 13:20:28

Is AngularJS possible without routing?

Is it possible to implement a simple application with one controller, without ui.router and so on, there is an api and a controller that works on it, but now it uses ui.router for this

angular.module('Monorythm')
    .config(['$stateProvider',function ($stateProvider) {
        $stateProvider
            .state('catalog',{
                url: '/catalog',
                templateUrl: 'views/catalog.tmpl.html',
                controller: 'CatalogController'
            })
            .state('catalog.template',{
                url: '/tempflate/:templateId',
                templateUrl: 'views/catalog.template.tmpl.html',
                controller: 'TemplateController',
                needAuth:false,
                isCalculation: true
            });
    }])

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Demian Smith, 2018-02-21
@Alenorze

Yes, it's possible.
1. Create a component angular.module('Monorythm').component('monorythm', {}) Here
is the component documentation https://docs.angularjs.org/guide/component
component
3. Then bootstrap the application angular.bootstrap(document.body, ['Monorythm']);
Voila.
I drafted an example for you
https://jsfiddle.net/sneas/gtrwzsn1/525/
but this one I found on the Internet using the Google search engine
https://jsfiddle.net/langdonx/gtrwzsn1/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question