bad loop spec pure JS

3 views
Skip to first unread message

rangana...@gmail.com

unread,
May 4, 2017, 3:19:17 AM5/4/17
to JavaScript Templates Engine PURE
var carJson = [{city:'AAAA'},{city:'BBBB'}]
   
    directive = {
        'car <- carJson':{
            'span.testspan':'car.city',   
            },
        };


<div id="testDiv">
             <span class="testspan" style="color: red;" >Ranafa</span>
    </div>


Can anyone please help with this, its gives following error

bad loop spec: "span.testspan"
pure.js:84 Uncaught pure error: bad loop spec: "span.testspan"error @ pure.js:84parseloopspec @ pure.js:179loopgen @ pure.js:462loopgen @ pure.js:459compiler @ pure.js:600compile @ pure.js:629(anonymous function) @ view:2450o @ jquery.min.js:2p.fireWith @ jquery.min.js:2e.extend.ready @ jquery.min.js:2c.addEventListener.B @ jquery.min.js:2

Mic (BeeBole)

unread,
May 4, 2017, 3:33:24 AM5/4/17
to JavaScript Templates Engine PURE
Hello Rangana,

A loop has 3 parts:
  1. select the node to iterate
  2. define which data to use for the loop, and give it a name
  3. assign values or attributes to the nodes inside the loop

Here is a working version of your example:

Cheers,
-Mic

Rangana Minesh

unread,
May 4, 2017, 6:19:23 AM5/4/17
to JavaScript Templates Engine PURE
Thank u very much Mic its working fine now.

~Rangana
Reply all
Reply to author
Forward
0 new messages