Meteor: Add Bootstrap CDN links before admin dashboard route -


enter code herei using materializecss ui of app. want add admin package , using yogiben:admin package. problem use admin package have install bootstrap packae can't because using materializecss ui work.

now there little hack trying do, add bootstrap cdn links before /admin route.

can me how add links bootstrap cdn on fly. when user logged in admin , go /admin route or /admin/* bootstrap css , javascript should loaded.

i trying this:

router.route("admin", { path: admindashboard.path('/admin'),   onbeforeaction: function(){     link: {       stylesheet: "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"     }     this.next();   }   }); 

but above code gives error

error: route path "/admin" exists name of "admin".

never mind. managed myself. here solution if else looking it.

    router.onafteraction(function(){       var routename = router.current().route.getname();       if ( routename.indexof("admindashboard") == 0 ) {         $("head #injectedbootstrap").remove(); //removes duplicates         $("head").append($("<link rel='stylesheet' id='injectedbootstrap' href='/css/bootstrap.min.css' type='text/css' media='screen' />"));         $("head #injectedbootstrapjs").remove(); //removes duplicates         $("head").append($("<script type='text/javascript' src='/js/bootstrap.min.js'></script>"));       }     }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -