routerlink

VueJs vue-router linking an external website

て烟熏妆下的殇ゞ 提交于 2019-12-30 08:12:27
问题 This may be simple, but I've looked over documentation and can't find anything about it. I want to have my 'github' link redirect to say, github.com. However, its just appending 'https://github.com' to my url instead of following the link. Here is a snippet: <BreadcrumbItem to='https://github.com'> <Icon type="social-github"></Icon> </BreadcrumbItem> (This is using iView for custom CSS, but 'to' works in the same way as router-link). What ends up happening is this: 回答1: <a :href="'//' +

Vue.js replace hashtags in text with <router-link>

孤街醉人 提交于 2019-12-23 01:04:28
问题 I receive some text from server which may contain some hashtags and when displaying this text I would like to convert these tags with links. Example text is: "Today #weather is very nice" Following code converts the string to Today <router-link to="/tag/weather">#weather</router-link> is very nice but it is not rendered again to <a> tag. <template> <p v-html="content"/> </template> <script> export default { methods: { convertHashTags: function(str) { return str.replace(/#([\w]+)/g,'<router

Angular 2 ngOnInit is not called when routerlink changes

橙三吉。 提交于 2019-12-19 04:04:43
问题 i have a menu bar that contain a list of menus loaded from express api and every menu is referenced to a page that have an alias wich will be the URL of that page i am trying to load the page when i click to menu, it's done but only when i refresh the page this my menu code export class MenuList implements OnInit { menus:Menu[]; menu:Menu; page:Page; constructor(private router:Router, private menuService:MenuService) { } getMenus():void { this.menuService.getMenus() .subscribe( menus => this

How to use router.navigateByUrl and router.navigate in Angular

倖福魔咒の 提交于 2019-12-17 18:15:10
问题 https://angular.io/api/router/RouterLink gives a good overview of how to create links that will take the user to a different route in Angular4, however I can't find how to do the same thing programmatically rather needing the user to click a link 回答1: navigateByUrl routerLink directive as used like this: <a [routerLink]="/inbox/33/messages/44">Open Message 44</a> is just a wrapper around imperative navigation using router and its navigateByUrl method: router.navigateByUrl('/inbox/33/messages

Dynamic queryParams with a routerLink link in Angular

[亡魂溺海] 提交于 2019-12-11 14:41:53
问题 I'm trying to pass a parameter to my routerLink within a loop. Here is what the array of objects looks like: Here is the loop with the routerLink link: <li *ngFor="let Achievement of AllAchievements"> example from multiple sources does not work with a variable 'x'. Outputs the letter x <a routerLink="page" [queryParams]="{x : 1}">anchor text</a> example from multiple sources link is outputted /%5B'page',%20%7BAchievement.type%20:%20'hello'%7D%20%5D' <a routerLink="['page', {Achievement.type :

Angular Child Route not working and redirect me to the same page

不问归期 提交于 2019-12-11 09:14:03
问题 Hi guys if you have a spare time please help me with my problem. I cant seem find a possible solution. So I've tried change my route and so far I didn't find any issues but if you find any flaws please let me know, also I try to find any type error and double-check my components, so far I didn't find one but then again let me know. I try to type my Route URL and it work but it displays the same page it wont redirect me to the page that I want. I even delete and install the node module , but

Angular 2 routerlinks work but browser url input routing doesn't

情到浓时终转凉″ 提交于 2019-12-11 06:24:59
问题 I'm trying to set up Routing in an Angular 2 ASP.NET solution using this tutorial as an example: https://angular.io/docs/ts/latest/tutorial/toh-pt5.html I have taken over everything relating to routing from this tutorial, yet I'm not getting the desired result. Router links in the UI work, but entering a routed url in the browser's url bar gives a 404 (not found) error. Clicking the Invoices link first brings you to localhost/Invoices, but refreshing afterwards yields 404. Project can be

Vue.js replace hashtags in text with <router-link>

馋奶兔 提交于 2019-12-09 03:43:25
I receive some text from server which may contain some hashtags and when displaying this text I would like to convert these tags with links. Example text is: "Today #weather is very nice" Following code converts the string to Today <router-link to="/tag/weather">#weather</router-link> is very nice but it is not rendered again to <a> tag. <template> <p v-html="content"/> </template> <script> export default { methods: { convertHashTags: function(str) { return str.replace(/#([\w]+)/g,'<router-link to="/tag/$1">#$1</router-link>') } }, data() { return{ content: 'Today #weather is very nice' }; } <

Angular 2 routerlink with multiple routes?

北城以北 提交于 2019-12-04 04:20:15
问题 I want to remove a class only one ONE route, (Or add a class on all BUT one route.) How is that possible? I have tried [routerLink] with multiple parameters to no avail: <div class='body-content' [routerLink]="['/fetch-data', '/counter']" [routerLinkActive]="['col-sm-9']" > <router-outlet></router-outlet> </div> Or, is there such a thing as [routerLinkNOTActive] or something similar like so: <div class='body-content' [routerLink]="['/home']" [routerLinkNotActive]="['col-sm-9']"> so, then it

Angular 2/4 - routerLinkActive not working properly

ⅰ亾dé卋堺 提交于 2019-12-03 15:14:11
问题 I have a problem with my routerLinkActive. Here is two Gifs to explain. First problem: When i start the app, none of the routerLinkActive give the class active. But if i click on a different route, that finaly works. When I click at first on the current route, the class isn't displayed. Here is my code: <ul class="nav"> <li *ngFor="let menuItem of menuItems" routerLinkActive="active" class="{{menuItem.class}}"> <a [routerLink]="[menuItem.path]"> <i class="material-icons">{{menuItem.icon}}</i>