Hi guys,

We're trying to integrate angularJs in a phpfox module.

To that end, we'd like to include code like:
Quote:

<li ng-repeat="story in stories">

{{story.Title}}



However, this kicks in Fox's template engine.

Do i have any way to escape some part of a view from the template engine?

Thanks
Sérgio
Last update on May 29, 2013 by HighSkillz Ltd.
Be the first person to like this.
A few different ways:
<ul><li ng-repeat="story in stories">
<span class="ng-bind: story.Title"></span>
</li></ul>

<ul><li ng-repeat="story in stories">
<span class="" ng-bind="story.Title || 'Loading...'"></span>
</li></ul>

The second option will render the "Loading..." before your AngularJS scripts are loaded at the footer instead of your users seeing an ugly {{story.Title}} rendered on the screen. AngularJS reads ng-bind values as javascript so the expressions like || and && etc. may be used. This example is useful for the very first blink of a second view of all your static elements before any scripts are loaded at the footer, where they should be unless you want your entire page to render after loading all your scripts.

There is also a little more advanced way to handle multi-library frameworks that use the same escape charters as AngularJS. In your config for your AngularJS module you can simply change the "{{" and the "}}" to whatever you wish:

angular.module("myStoryApp", [])
.config(function($interpolateProvider) {
$interpolateProvider.startSymbol("!!");
$interpolateProvider.endSymbol("!!");
});
Last update on April 21, 2014 by Dreality.
Be the first person to like this.