-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to load a view that doesn't exist in the sidemenu #41
Comments
@leighmillard We use ui-router for routing. I think you might not clearly understand how nested states work https://github.com/angular-ui/ui-router/wiki/Nested-States-%26-Nested-Views I think you might need to name your states |
If I use an abstract state then this creates a menu option with a dropdown which isn't what I need. There are basically 3 parts to the moduel, list.html should always load when 'courses' menu option is clicked and then there is another button for 'create' and an 'edit' on each course listed. I have tried several different router techniques without any luck. |
I can do it by using the following code but the 'courses' menu option does not highlight in the sidemenu
|
@leighmillard there is a helpful doc that explains router + sidebar in our theme https://akveo.github.io/blur-admin/articles/051-sidebar/ |
@smartapant thanks for the link to the sidebar docs. I had already had a look through this and it doesn't seem to cover this scenario. I'm at a bit of a loss what to do with this as I have the same scenario running in other applications where the sidemenu is manually coded but as this is run using a directive it needs to work in a particular way. I can create a standard menu option as well as dropdown options using abstract but if I create 'courses' as abstract it cannot be a standard menu item, any other method then loses the ability to have the active menu option highlighted. The easiest way I can explain what it is I want to do is if the user was to click a 'view' button on the one of the dashboard widgets it would go to dashboard/view/1234 (1234 being the ID) This would be a new view and not a nested view on the same page. |
i dont think ui router can recognize coursesCreate & coursesEdit are in fact a child of courses route. have you tried making or else, try using modal window. |
i'm having exactly the same problem. I have a main state 'jobs' and the substates 'new', 'edit', 'list' If I go for
clicking the link in the sidebar does not load the jobs.list state automatically and the JS console is not throwing any errors. But if i make the parent abstract and click on the sidebar link the JS console throws errors, but typing /jobs in the address bar successfully loads the view with the embedded default state. This looks like a problem with ui-router itself. using
otherwise i have no idea what would make it possible to get nested views for a sidebar-single-link. |
@blackanthrax |
@vazh /jobs needs to be abstract, otherwise you can't render the sub-views. $stateProvider
.state('jobs', {
abstract : true,
url : '/jobs', |
@vazh @leighmillard okay i have a workaround. This is not really clean, but my javascript experience is quite limited and this needs to be overlooked by someone with more experience. What i've done now is creating an abstract page with subpages as i did above. Now i edited stateRef: s.name, with stateRef: s.abstract === true ? meta.defaultSubview : s.name, and provided the default subview in the module definition of my module $stateProvider
.state('jobs', {
abstract : true,
url : '/jobs',
templateUrl : 'app/pages/jobs/jobs.html',
title : 'Jobs',
sidebarMeta : {
icon : 'ion-ios-clock-outline',
order : 100,
defaultSubview : 'jobs.list'
}, I hope this helps atleast a bit. |
Hi,
I have a module called courses which is loading ok. When loaded it shows list.html which is a list of the courses.
Each course can then be edited by going to the courses.edit state but because this isn't loaded into the menu I can't do it.
I can see the URL changing to courses/edit/mycourseID but the content in the ui-view does not change.
Can you point me in the right direction to get around this?
(function () {
'use strict';
angular.module('BlurAdmin.pages.courses', [])
.config(routeConfig);
/** @ngInject */
function routeConfig($stateProvider, $urlRouterProvider) {
$stateProvider
})();
The text was updated successfully, but these errors were encountered: