Previously i have published a post about using for loop in Ant to read a text file line by line.
The <for> task requires a list attribute containing a comma separated string. Here is an example.
<echo message="The first five letters of the alphabet are:"/>
<for list="a,b,c,d,e" param="letter">
This example make use of jquery.hammer.js for implementing delegated events for inner elements. Just like what we did in the TouchSwipe Example.
We have talked about TouchSwipe in previously.
Unlike TouchSwipe which is a jQuery plugin, hammer.js is independent of jQuery. It supports tap, swipe, drag and other mobile touch events. Here is an simple example.
In the previous post, we attach the swipe event listener directly on the #box element.
How about if your target elements is dynamically added to the DOM? In that case, the event listener would not work for the newly inserted inner elements. A work around is attached the event listener to the parent element instead. Here is another example for the delegated event implementation of TouchSwipe.
In Apache Ant, we can define custom task using MacroDef.
1. Install the grunt-contrib-yuidoc as one of your your project dev dependency.
- npm install grunt-contrib-yuidoc –save-dev
2. To illustrate the example, i created /app/scriptes/human.js as follow.
- (webroot folder)
- XMLHttpRequest cannot load file:///C:/Users/user/Desktop/readJson/data/file-1.json. Origin null is not allowed by Access-Control-Allow-Origin.
Although it should work if i upload those sources files to a web server, i would still make it work locally especially for development purpose. So here is a small trick which could ask the Chrome browser to bypass this cross-domain restriction.
Let’s continue our tour on Yeoman.
Bower is a tool to manage your js dependencies of your project. you can find out all the dependencies on the bower.json. The bower.json below is the one initialized in the AngularJS project.