1

These are the premises I'm trying to implement with ui-router:

  • The root page has a ui-view; on click it is populated with the main page (main.html).

  • The main page has two named ui-view's: view1 and view2.

  • The main page also has four links to populate (1) page11 or page12 in view1, (2) page21 or page22 in view2 (in any combination).

  • I use abstract states to be able to select which page goes to its respective named view.

I posted my attempt on plunker, any ideas if this is achievable?

UPDATE

I think this plunk explains more clearly what I'm trying to achieve. Click on page11 and then on page21; each will display their template and clear the other. I need both templates to be shown simultaneously.

9
  • yes, this is achievable. What is the question? Commented Dec 12, 2014 at 15:12
  • how can be implemented? Please see my attempt on plunker. thanks Commented Dec 12, 2014 at 15:15
  • create states for each page combination that you need to display. The state for the main page is a child of the root state, and these for the sub-pages are children of the main page's state. that is all. Commented Dec 12, 2014 at 15:19
  • how can I select dynamically which template I can populate in each named view? When you go to a specific state the template names are predetermined in the view declaration. Commented Dec 12, 2014 at 15:26
  • for each combination you will have a state (this is first that comes to mind, you can end up with a lot of states if your real set of pages is big, but for this plnkr example it is still manageable), and there you will have all your pages listed. At least this approach can give you an ability to write your first iteration. I do not know how to assign templates to views dynamically. Need to read on it. Commented Dec 12, 2014 at 15:31

1 Answer 1

0

This is how I solved this problem: I created a directive that compiles markup (using $compile) and used two directives in my html page, each with a different markup.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.