Andreas,

that's true for small single-page apps. But what if you have a really big/complex app with lot of markup? If you don't want to deliver such a app as one very big page, there are two options. The simplest is to create several tapestry pages and split the app into smaller pieces. But that's not always possible, especially when different pages interact with each other (example: one of our apps has multiple "modules" - e.g. management of contants and management of tasks. You can assign a contact to a task and even create a new contact from within a task. So the "task" module uses parts of the "contacts" module. If you split things into pages, it's hard to use frontend markup/code from a different page here). A different approach is to dynamically load the markup from other modules on demand. That's what we are doing at the moment, without angular but using tapestry's zones. We just inject a contact page into the tasks page and can provide a "create new contact" dialog via zone updates. I'm still doing some research on angular to see if it may be a technology we use in future - so I try to find out what's possible here and what not. Rendering partial pages is here just an option. Yesterday I've got my code working using blocks which I render to string. I used the code from https://issues.apache.org/jira/browse/TAP5-1864 and added my comment + code there. That works fine for me and gives me what I want. Nevertheless there's no reason why it should not be possible to render xml/xhtml fragments with tapestry which used to work on older versions and opens new usecases for tapestry.

Regards,
Michael.




I'm curious - why do you want to use tapestry's component mechanism to
provide the angular templates?

Wouldn't they be loaded only once during the lifecycle of the angular app?
Wouldn't you then want to bundle
them in a single file and skip the extra template requests?




On Thu, Nov 7, 2013 at 5:46 PM, Michael Wyraz <michael.wy...@evermind.de>wrote:

Hello,

I'm implementing a proof-of-concept application with tapestry 5.4 and
angularjs. All basic things work, now I try to find some best practice.

Angularjs provides the opportinity to dynamically load content (called
'view templates') into a page area and connect it with logic. This allows
to split up a large application into parts - a concept very similar to
tapestry's components. One can embed templates within the page (surrounded
by a special script tag) or can load it from the server.

Angularjs behaves in the following way to load "mytemplate":
- check if there's a script tag <script type="text/ng-template"
id="mytemplate"> - if yes take the script's content as template
- otherwise load "mytemplate" from the server relative to the page's url

Now I want to use tapestry's component mechanism to provide such templates:

1. I could simply put all into one page and put the template's content
into tapestry components:
<script type="text/ng-template" id="mytemplate">
   <t:mytemplate/>
</script>
This is simple but results in a (very big) page

2. I could create a page for each template.
This would make angular to load the template on demand.
Problem here is that tapestry will not allow to create "partial pages"
starting with a <div>.

3. Tweak angularjs to use some zone update mechanism to load the templates.
I have no idea if/how this is possible. If someone already did such,
please let me know.

What do you think would the best way to do it?

Regards,
Michael.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org





--
Mit freundlichen Grüßen / Regards

Michael Wyraz

evermind GmbH
Schorlemmerstraße 1
04155 Leipzig

Tel.:       +49 (0)341-25 39 66 - 0
Fax:        +49 (0)341-25 39 66 - 1
Funk:       +49 (0)177-73 00 00 3
E-Mail:     michael.wy...@evermind.de

HRB: 21586
Amtsgericht Leipzig

Geschäftsführer:
Christoph Klemm
Thomas Grünert
Michael Wyraz


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org
For additional commands, e-mail: dev-h...@tapestry.apache.org

Reply via email to