Polymer - How to create two main pages in polymer project - polymer-1.0

I have a polymer project with polymer starter kit. In the project I have the index.html the main page of the project.
I need to create an administration page that will be the main page for the administration and I don't find a way to execute another page.
I created the new page administration.html and I try to execute the url: http://localhost/administration.html but the routing send me again to the index.html.
I figured out that the problem is with the routing but I don't know exactly how can I fix this.
I will appreciate any help on this.

The Polymer team has just introduced their own approach to the routing problem with the brand new carbon-location and carbon-route elements. You can find a nice intro here at the main Polymer page. If you want to see how this would work with the starter kit, check out psk-app at the psk2 branch. The team has just started to do a full rewrite, but you can easily see how routing is handled in Polymer now.
Specifically, look into how they import pages, set the pattern and data attributes in carbon-route and then use the data object exposed by carbon-route in the iron-selector and iron-pages elements with [[params.page]].
Also, Rob Dodson is preparing a Polycast on carbon-route for episode 46, which will have routing explained in more detail.

Related

Add an additional page to an Angular SPA

The Scenario
I'm developing the front-end (CSS only) of an Angular SPA.
I'm not especially familiar with Angular routing.
I'd like to add a standalone page containing Bootstrap components just for development purposes (yes, I know this means it won't be a single page application anymore). This way I have one unified view with all the components so I don't have to switch back and forth while working on the CSS. It also acts as documentation for the Bootstrap for the other devs to refer to.
What I've tried
I originally added a bootstrap.html page to the app folder, alongside the app's index.html This worked at first, but has now stopped working. What would be the best/standard way to achieve something like this?
Update: I've managed to fix some of the JS errors, so the page is up and running again. My question remains though: "is there a way of adding a standalone page that is considered standard/best practise, or is it literally just add a separate HTML page at the app root?"
If you use a target='_self' in your linking anchor tag, this should force a full page reload, and that will avoid the angular routing - which is where I expect your request is getting hijacked (by design).
e.g.
link
Answering your updated question
Not to my knowledge, since (as you correctly pointed out) this mixes the SPA design pattern.

Polymer with AngularJS using partial view

This isn't a problem question, but a theory/possibility question. I have made a polymer portfolio site with a list of image links that points to a html page in my file directory for example /projects/test.html. The problem that I have is that every time I click on the link it loads the new page because I have it as a separate html.
I read AngularJS can provide partial view. So if I can combine angular, I can keep my website header and just load the content of the links into the partial view.
I was wondering if this is doable, and do I have to fully install angular and change the file structure or can I just import AngularJS file and code from there?
Also AngularJS does provide routing which I will love as it make my url cleaner.I am just asking so I don't have to waste time if this attempt will not work.
Yes, all of this is easily achievable with Angular; you will not need to modify Angular. A couple things to get you going. This won't make sense right now but come back once you've dug in a little.
For prettier urls set $locationProvider.html5Mode(true);
You will want your server to serve all 404s for text/html requests to return your Angular application (probably /index.html on your server). This is so that if someone goes to https://mycoolsite.com/projects/neato (which exists in your Angular app, but NOT on the server) your Angular application will load and the router will display the correct route.

Use backbone routing without changing url

I have developed a webapp using backbone.js and more importantly a backbone router. Now I have been asked if this app that changes the URL depending on what section you visit, can be used within a single div as mini module on a website. Almost like a widget within a dashboard.
Any ideas how I could quickly implement this..... I feel like i'm missing a simple solution here.
Thanks,
Gary

How to integrate AngularJS with Lithium?

I need to add new features to an already existing application. The application is built using Lithium and jQuery. The features that needs to be included have a complex view which allow users to analyze data and perform CRUD functionality. I won't go into details about the features here, but after working on a few simple Angular tutorials and side projects, I know that using AngularJS to create this view will make my life a lot more easier than creating the view using jQuery.
Over the course of the next few months we may convert the entire app to AngularJS.
I am uncertain about where I should place the Angular files and how to setup routing. How can I integrate AngularJS to Lithium so that part of the Lithium routing works and part of it is handled by AngularJS.
I also found this answer on stackoverflow but it doesn't mention folder structures or how to integrate Angular with Lithium. I think this link mentioned in the answers is supposed to have what I am looking for but it doesn't seem to exist anymore.
The link is down, but you can clone the source repository and run it yourself here: https://github.com/nateabele/li3-angular-presentation
Regarding organization, the simplest way would be to place the directory structure for your Angular components inside of /webroot. The more advanced (and in my opinion better) way would be to make them two separate applications: an AngularJS UI app, and a backend API in Li3 that it talks to.

Setting up example app within directory path

I have a Shopify store, which uses the liquid templating engine. I'm trying to setup a blog on within this site / theme.
I would like to design the blog with angular. The blog has it's own directory within the site, and it's not on a subdomain of it's own.
http://holstee.com/blogs/themes
http://holstee.com/blogs/themes/111111-article-title
I'm wondering if this is something that can be done with angular, and why it's the example that's up isn't binding? Is it a base url thing?
If your wondering why your example on that page isnt working, bring up your Javascript console (Command + J) and you'll see the error. You need to initialize the myApp module.
Something like
angular.module('myApp',[]);
The error can be found here:
http://tinyurl.com/mbvhc5a
And to answer your question, yes you can use angular for your blog, but the question is more likely to be is it the right choice? For most blogs, the answer would be no, unless your planning a high amount of user interaction with the UI.

Resources