javascript - Using Express Handlebars and Angular JS -


background

i building website uses nodejs server, express handlebars(just handlebars server side) , , angularjs client side stuff.


the problem

angularjs , handlebars use same syntax templating
{{foo}}
causes problem angularjs code interpreted express handlebars first, throw error because data trying pull exists in angular not node.


the question

is there way angularjs , express handlebars work together?


possible solutions

  • change syntax of angularjs
    • i looking @ backbonejs , looks possible change syntax. there possibly similar angularjs.
  • create ng helper in express handlebars.
    • it return un-parsed content. couldn't figure out how this.

your first solution possible, angularjs allow change start/end symbols of text interpolation this:

appmodule.config(function($interpolateprovider) {   $interpolateprovider.startsymbol('{[{');   $interpolateprovider.endsymbol('}]}'); }); 

then use in template:

<div>{[{message}]}</div> 

also see: $interpolateprovider documentation

hope helps.


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 -