router

Node.js module-specific static resources

走远了吗. 提交于 2019-11-29 11:28:43
Is there an elegant way to bundle static client-side file resources (scripts,images,etc) into an Express module and systematically avoid naming conflicts? It's easy enough to register a module-specific instance of the static object like so: app.use(express.static(modulePath + '/public')); app.use(express.static(__dirname + '/public')); but if both directories contain a "styles.css" file, it would seem that the one from the module will eclipse the one for the application. A subdirectory within the module's public could be used to avoid this problem, but what I really want is a way to map the

Pass invisible or hidden parameters using routerLink Angular

风格不统一 提交于 2019-11-29 11:21:52
问题 I have router link like below: <button class="take-a-tour-btn" [routerLink]="['/dashboard', {'showTour':'show'}]"> I want to pass parameter showTour . But, when I do this, the parameter is visible in url and I would like to hide it. I have gone through so many references(which says about optional parameters) ,but with no success in my case. How could I solve this? 回答1: I'm not sure, if there is a way to do it, because the data need to be presented in the URL string. My suggestion is using

Ember.js Router: How to animate state transitions

♀尐吖头ヾ 提交于 2019-11-29 05:19:35
问题 Has somebody found a good way to animate state transitions? The router immediately removes the view from the DOM. The problem with that is that I can't defer that until the end of the animation. Note: I'm using v1.0.0-pre.4 . 回答1: Billy's Billing just released an Ember module that supports animated transitions. 回答2: I'll expand on Lesyk's answer. If you need to apply it to multiple views in a DRY way, you can create a customization class like this: App.CrossfadeView = { didInsertElement:

In Angular2 RC4 how do I add components to the precompile array?

旧巷老猫 提交于 2019-11-28 23:09:12
I just updated my Angular2 project to RC4 and the router is now sending out this warning message in the console when I open my application: router.umd.js:2466 'FrontpageComponent' not found in precompile array. To ensure all components referred to by the RouterConfig are compiled, you must add 'FrontpageComponent' to the 'precompile' array of your application component. This will be required in a future release of the router. I've tried to figure out what exactly I need to do to fix this but since documentation is sparse I can't find an answer. What is this precompile array and where can I

Redirect user with router depending on logged in status

落花浮王杯 提交于 2019-11-28 16:13:47
I would like to automatically route to a login page if the user is not logged in. app.module.ts import { RouterModule, Routes } from '@angular/router'; import { AppComponent } from './app.component'; import { LoginComponent } from './login/login.component'; import { DashBoardComponent} from './dashboard/dashboard.component'; import { NotFoundComponent } from './not-found/not-found.component'; const APPROUTES: Routes = [ {path: 'home', component: AppComponent}, {path: 'login', component: LoginComponent}, {path: 'dashboard', component: DashboardComponent}, {path: '**', component:

Angular2 (rc4) - Check active child route in parent component

别等时光非礼了梦想. 提交于 2019-11-28 12:42:32
I am trying to check the active child route in a parent component, but I am having difficulties with it. I have tried to subscribe to the ActivatedRoute by doing something like this: class ParentComponent { constructor(private _route:ActivatedRoute) {} ngOnInit() { this._route.data.subscribe(value => console.log(value)}); } } I have read a lot of threads on Stack Overflow, but can't find a solution that checks and gets updated regarding the child routes of a parent component. Any ideas? You can access active child route using below code snippet constructor(private router:Router, private

Angular 2 add routerLink in child which points to root router

被刻印的时光 ゝ 提交于 2019-11-28 07:31:50
问题 Currently I am developing a web app using Angular 2 Beta 8. Now I am facing a problem with nested routes when using the routerLink directive. The router hierarchy is: AppCmp |-> NewItemFormCmp |-> UserDashboardCmp |-> MyItemsCmp The involved components are: @Component({ ... }) @RouteConfig([ {component: NewItemFormCmp, name: 'NewItemForm', path: '/item/new'}, {component: UserDashboardCmp, name: 'UserDashboardCmp', path: '/me/...', useAsDefault: true} ]) export class AppCmp { } @Component({ ..

Ruby on rails: singular resource and form_for

纵然是瞬间 提交于 2019-11-28 05:11:15
I want user to work with only one order connected to user's session. So I set singular resource for order routes.rb: resource :order views/orders/new.html.erb: <%= form_for @order do |f| %> ... <% end %> But when I open the new order page I get an error: undefined method `orders_path` I know, that I can set :url => order_path in form_for , but what is the true way of resolving this collision? mckeed Unfortunately, this is a bug . You'll have to set the url like you mention. = form_for @order, :url => orders_path do |f| Where does that magic path come from? It took me a lot of tracing but I

Node.js module-specific static resources

冷暖自知 提交于 2019-11-28 04:39:07
问题 Is there an elegant way to bundle static client-side file resources (scripts,images,etc) into an Express module and systematically avoid naming conflicts? It's easy enough to register a module-specific instance of the static object like so: app.use(express.static(modulePath + '/public')); app.use(express.static(__dirname + '/public')); but if both directories contain a "styles.css" file, it would seem that the one from the module will eclipse the one for the application. A subdirectory within

Domain name for my PC: how to (tried No-IP, DuckDNS and ngrok)

让人想犯罪 __ 提交于 2019-11-28 01:41:30
I want: ping server on my PC by it domain name from remote. I have: DynDNS services DuckDns (or No-IP , config in no-ip is even harder). It gets me an IP 94.154.220.216 and (sub)domain http://my_domain.duckdns.org . To configure DuckDNS on PC I need just specify some token and my domain name ( my_domain ). Also I've launched server on lacalhost:3000 . Also when I go to CanYouSeeMee it says that my IP is 94.154.220.216 (that's good). And I configured static IP for my PC (let's say 200.300.1.15 ) And Setting port forwarding for with help of Port Forwarding Wizard (Port= 3000 , Protocol=TCP,