client side templating - Is there a Facelets-like feature in AngularJS where views define the template and its replaceable parts? -


if know facelets, isn't simple jsp include or angular ng-include template defines contents should in template.

in facelets, template defines parts of dynamic or replaceable , view can use , tell contents should in replaceable parts of template. in facelets, single page can feed replaceable parts of template in one file.

facelets example:

template: template.xhtml:

    <h:body>         <div>             <ui:insert name="main_section">main section</ui:insert>         </div>         <div>              <ui:insert name="section">section</ui:insert>         </div>         <div>              <ui:insert name="sub_section">sub section</ui:insert>         </div>     </h:body> 

view: somepage.xhtml

<ui:composition template="./template.xhtml">     <ui:define name="main_section">         welcome main section defined somepage.xhtml     </ui:define>      <ui:define name="section">         .. section defined somepage.xhtml     </ui:define>      <ui:define name="sub_section">         .. subsection defined somepage.xhtml     </ui:define> </ui:composition> 

this unlike regular include template in template not allow pages define contents of template other used in template.

nginclude example

view: main.html

<div>     <ng-include src="./somepage_main_section.html"></ng-include>     <ng-include src="./somepage_section.html"></ng-include>     <ng-include src="./somepage_sub_section.html"></ng-include> <div> 

problem

in ng-include, there's no way somepage.html can define or feed other replaceable parts of template. has separate parts of template multiple files , hardcode it.

i know facelets works on server side while ng-include works on browser side what's important concept. as possible, want same concept applied in angularjs. we're using play framework way means can't use facelets.

with play can use flexible templating :)

<!--index.scala.html content--> @() <!--template.sacala.html  contains css , js path (head)--> @template(){    @menu(somepamar)     <!--content-->      @footer() } <!--/index.html.scala content--> 

this web site it's introduction design of play framework , angularjs http://pauldijou.fr/blog/2013/02/17/angularjs-routing-playframework/


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -