aurelia-router

Setting a “related” route as active in Aurelia

允我心安 提交于 2019-12-04 09:57:36
I have two routes in my Aurelia app, a list (Work) and a detail (WorkDetail). In the navigation, I only have the list route: Home | *Work* | Contact | . . . When I navigate to the WorkDetail view, I would like to set the Work route as active in the navigation. What I've tried so far is setting the route active in the activate() callback of the WorkDetail view and inactive on deactivate() : import {inject} from 'aurelia-framework'; import {Router} from 'aurelia-router'; @inject(Router) export class WorkDetail { constructor(router) { this.workRoute = router.routes[2].navModel; }; activate(params

How to define and render submenu-items, using Aurelia's Router

一世执手 提交于 2019-12-04 09:48:44
In an Aurelia app, I've defined a simple route like this: configureRouter(config: RouterConfiguration, router: Router) { config.title = 'Marino'; config.map([ { route: ['', 'home'], name: 'home', moduleId: './pages/home/home', nav: true, title: 'Home' }, { route: 'colors', name: 'colors', moduleId: './pages/colors/overview', nav: true, title: 'Colors' } ]); this.router = router; } This works perfectly as all the examples mention, by implementing repeat.for and href.bind like this: <ul class="main-navigation"> <li repeat.for="row of router.navigation" class="${row.isActive ? 'active' : ''}"> <a

Aurelia router view animation with swap-order=“with”

点点圈 提交于 2019-12-04 09:16:18
I am using aurelia-animator-css to animate router views. Upon navigation to a new router view, I want the current view to slide off screen to the left while the new view slides onto the screen from the right. Here is my router-view element: <router-view swap-order="with"></router-view> Here is the top element in each of the views: <div class="pages au-animate"> And here is the css: @keyframes slideLeftIn { 0% { transform: translate(100%, 0); } 100% { transform: translate(0, 0); } } @keyframes slideLeftOut { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } } .pages.au

Aurelia-Router: Modify route params and address bar from VM with Router

邮差的信 提交于 2019-12-04 00:59:09
问题 I want update the url-params in the address bar without routing. But i'm not sure how to do this with Aurelia-router from a view-model. In my case I send IDs in the url which gets picked up by the view-model's activate-method. The route looks like this: http://localhost:3000/#/test/products?0=2599037842&1=2599080552 Then I want to be able to remove IDs from the url without reactivating the view-model , url result exemple: http://localhost:3000/#/test/products?0=2599037842 Hopefully there is

Aurelia: How navigate between child routes

梦想的初衷 提交于 2019-12-03 15:25:34
I'm trying to navigate from one child route to another, but I continually get Route not found . My primary question: how to navigate between child views? Below is the code, and I'll have additional questions below, too. App Mode-View App Class: export class App { configureRouter(config, router) { config.title = 'My Site'; config.map([ { route: ['','job-view'], name: 'jobView', moduleId: './job-view', nav: true, title:'Jobs'}, { route: ['services'], name: 'services', moduleId: './services', nav: true, title:'Services'} ]); this.router = router; this.router.refreshNavigation(); } } Q.2 : Why do

Customizing Aurelia to use .cshtml

一个人想着一个人 提交于 2019-12-02 09:39:32
问题 I found a very helpful article showing how to use Razor partials (cshtml) with aurelia. However, I could not get the code to run and learned from RobEisenberg comment that ConventionalViewStrategy.convertModuleIdToViewUrl had been deprecated. He commented "You want to use the ViewLocator service." I followed the gitHUb project and could not see that it was directly relevant to my using with MVC5 and Razor Partials. So I am confused. This is the example main.js file that I was hoping I could

Customizing Aurelia to use .cshtml

蓝咒 提交于 2019-12-02 04:57:39
I found a very helpful article showing how to use Razor partials (cshtml) with aurelia. However, I could not get the code to run and learned from RobEisenberg comment that ConventionalViewStrategy.convertModuleIdToViewUrl had been deprecated. He commented "You want to use the ViewLocator service." I followed the gitHUb project and could not see that it was directly relevant to my using with MVC5 and Razor Partials. So I am confused. This is the example main.js file that I was hoping I could tweak in order to route aurelia to the Home/Index/Index.cshtml instead of index.html import {LogManager}

Reload current page in Aurelia

时光毁灭记忆、已成空白 提交于 2019-11-30 17:22:28
I have an Aurelia application where the user can select the company they're currently "working on". Every page in the app is dependent on the currently selected company, and the user can select a new company from a drop-down menu. The drop-down is a component sitting on the nav-bar. What I'd like is to have that component reload the current page on the change.delegate handler without restarting the app. So setting window.location.href is out of the question. Is there a way to force the aurelia Router to reload the current route/page? The alternative would be to use the EventAggregator to

How to pass data from ASP.NET WebForms to Aurelia Global Scope

不羁岁月 提交于 2019-11-29 21:09:19
问题 I am bootstrapping Aurelia from a Web-forms based legacy application. My authentication related information is maintained in the web-forms application in the Custom Base Page class. How do I pass & maintain this authentication information to Aurelia's global scope? So that I can use it while building the menus using routes to show/hide certain menu items based on the user/role? 回答1: You could put logic your custom base page to add a <script> tag to the head of the document that makes all the

Configure IIS server to work with Aurelia framework and push state

无人久伴 提交于 2019-11-29 13:17:36
I have created a basic aurelia app starting from this repo and I was trying to get rid of the # (hashtag) in the URL bar. I have 2 projects, one running WebApi on a machine and one running an empty web project (not MVC) on another machine. On the official documentation website it only says how to configure your routes but my project is not MVC oriented. How can I configure the IIS server from Web.config in a sense that when I access http://localhost/home it should start the aurelia framework rather than the 404 not found page? Matt McCabe I'm using the Azure which needed a web.config to handle