Setting up UI router for an external login page

I have been working on enhancing the blur-admin project by adding a login page along with its own controller.

To achieve this, I created a separate controller folder within the pages directory called demoadmin.login. The login functionality is performing well within the dashboard, but now my goal is to display it as a standalone page.

Currently, it appears like this:

https://i.sstatic.net/kFx96.png

However, I would like it to be displayed outside as shown here:

https://i.sstatic.net/X0gTY.png

Below is an excerpt from my app.js file:

'use strict';

angular.module('bluradmin', [
    'ngAnimate',
    'ui.bootstrap',
    'ui.sortable',
    'ui.router',
    'ngTouch',
    'toastr',
    'ui.slimscroll',
    'angular-progress-button-styles',
    'ngStorage',
    //'smart-table',
    //"xeditable",
    //'ngJsTree',

    'bluradmin.theme',
    'bluradmin.pages',
    'bluradmin.login'
]).run(function ($localStorage) {
    console.log($localStorage);
});

In addition, I made changes to my pages.module.js:

(function () {
    'use strict';

    angular.module('bluradmin.pages', [
        'ui.router',
        'bluradmin.pages.dashboard'
    ])
        .config(routeConfig);

    /** @ngInject */
    function routeConfig($urlRouterProvider, baSidebarServiceProvider) {
        $urlRouterProvider.otherwise('/login');
    }

})();

What steps can I take to configure the ui-router in order to achieve this desired behavior?

Answer №1

When setting up your project:

<div ui-view>
</div>

In your application's main layout file:

 <div class="row main" ui-view>
 </div>

Next, configure the routes in your app:

.config(function ($stateProvider, $urlRouterProvider) {


    $stateProvider

        .state('login', {
        url: '/login',
        templateUrl: 'templates/login.html',
    })

    .state('app', {
            url: '/app',
            templateUrl: 'templates/app.html'
        })

     .state('someOtherState', {
         parent: 'app',
         url: '/someUrl',
         templateUrl: 'templates/someTemplate.html'
     })

    $urlRouterProvider.otherwise('/login');

Answer №2

To establish a distinct abstract view/state for the application, as well as delineate another separate view specifically for the login functionality, follow this example:

$stateProvider
    .state('app', {
        url: '/',
        abstract: true,
        templateUrl: 'menu.html'
    })

    .state('app.home', {
        url: 'home',        
        views: {
            'page-view': {
                templateUrl: 'home.html',
            }
        }
    })

    .state('login', {
        url: '/login',
        templateUrl: 'login.html',
        }
    })

Within the menu.html file, include the following structure:

<div ui-view="page-view"></div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The delete function is not functioning

I need help with implementing a custom Angular directive that includes a delete button to remove itself. When I click the button removeMe, it is not deleting an item from the array. Any suggestions on what might be causing this issue? HTML: <button t ...

In Node.js, the module.exports function does not return anything

After creating a custom function called module.exports, const mongoose = require("mongoose"); const Loan = require("../models/loan_model"); function unpaidList() { Loan.aggregate([ { $group: { _id: "$ePaidunpaid", data: { $pus ...

Select all or deselect all options in a multiple-choice checkbox

Looking for a solution to manage multiple check-boxes? Here is an example code snippet. HTML: <fieldset data-role="collapsible"> <legend>Pick one</legend> <div data-role="controlgroup" id="ZIBI" align="right" > </di ...

Could we confirm if this straightforward string is considered valid JSON data?

There are numerous intricate questions on Stack Overflow about whether a complex structure is considered valid JSON. However, what about something much simpler? "12345" Would the provided code snippet be considered valid JSON? ...

Is it possible to extract the value from the JSON response using this.responseText?

Having trouble extracting data from a json response This is the HTML code I am using. index.html <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head ...

Necessary workaround needed for HTML time limit

Our HTML page has been designed to automatically timeout after 10 minutes of inactivity. This functionality is achieved through the following code: function CheckExpire() { $.ajax({ type:'GET', url:self.location.pathname+"?ch ...

Learn how to deactivate the pause button with just one click and re-enable it once the popup appears using Angular2 and Typescript

Can anyone assist with solving an issue I am facing with a timer and a pause button? I need the pause button to be disabled once clicked, until a popup appears, then it should become enabled again. My code snippet is provided below: HTML: <button md-i ...

AJAX Communication Issue: Data not transferring from client-side to backend in C# MVC 5 via HTTP

I've encountered a problem with sending data from a JavaScript frontend to my C# MVC 5 backend. Despite debugging the code in Visual Studio, the data I'm trying to pass always ends up as null. Below is my front end code: var file = $("#my-file" ...

The ng-click directive is not functioning within a script tag

i found this piece of code HTML: <script type="text/ng-template" id="custom-footer"> <div> <table cellspacing="0" cellpadding="0" ng-controller="SearchController" style="border:solid 1px black; font-family:verdan ...

Is it possible for you to enter "1.00" instead of just 1 when using the input type as number?

I am using Polymer paper-input and I would like to ensure that my input with type "number" always displays 2 decimal points, even when it is a whole number. Instead of just displaying as "1", I want it to be shown as "1.00" at all times. I have tried sett ...

Having a flash video load on a new page in the same position as it was on the previous page

On my website, I have a subtle flash video playing in the background that loops every 30 seconds. It's not necessary for navigation, just a nice visual touch. However, every time a new page is loaded, the video restarts from the beginning. I'm l ...

The implementation of recursive setTimeout function on a randomly selected index in an array is failing to execute properly in JavaScript

As a novice in JavaScript, I am attempting to create a web application that can play an array list of audio files. The user must first select the number of follow-up questions and the duration between each question from elements 4 to 8 in the array list. H ...

Creating a Selectable Child Form in ReactJS that Sends Data to Parent Form

Sorry for the lack of details, I'm struggling to explain this situation clearly. I'm currently learning ReactJS and JS. In a project I am working on, I have the following requirements: There is a form where users can input text and numbers. The ...

I need RxJs to return individual elements to the subscriber instead of an array when using http.get

I've been developing an Angular 2 app (RC5) with a NodeJS backend RESTful API integration. One specific route on the backend returns an array of 'Candidates': exports.list = function (req, res, next) { const sort = req.query.sort || null ...

Flowplayer playlist stops after playing the first clip

I am having issues with my flowplayer configuration, as it is not behaving as I expected. After the first video ends, I want the second and subsequent videos to play automatically. Can anyone provide some guidance on how to achieve this? $f("player", "/fl ...

The JQuery pagination feature fails to function properly once an AJAX load is initiated

I am using jspages.js to implement pagination with jQuery. Everything works fine when the page is initially loaded. However, I encounter an error when the content for pagination is loaded after an ajax call. The plugin does not seem to work as expected. ...

Exploring Android Webview capabilities using HTML 5 geolocation

Utilizing a webview to load a web application, I am using the HTML 5 geolocation API within the page to detect the user's location. While this feature works seamlessly in all browsers and even in an iOS application, I am facing issues getting it to fu ...

Testing React Hooks in TypeScript with Jest and @testing-library/react-hooks

I have a unique custom hook designed to manage the toggling of a product id using a boolean value and toggle function as returns. As I attempt to write a unit test for it following a non-typescripted example, I encountered type-mismatch errors that I' ...

Encasing the window global variable within an AngularJS framework

Currently, I am encapsulating a global variable within a factory in order to make it injectable. Here is an example of how it's done: angular.module('Analytics').factory('woopra', [ '$window', function ($window) ...

What steps can I take to ensure that my server is easily accessible to all users?

I have successfully created a chat server using Node.JS and it is currently running on my LocalHost: 127.0.0.1. However, I want to make this chat server accessible to anyone, not just me. Can you guide me on how to transfer this Chat server to my live serv ...