Hi, It's not easy to understand Could you provide an example of the data?
For what I understand, you want to show the list of string that you got from the file, and have a button next to it like this: String 1 [button1] String 2 [button2] .... However I'm not sure of what you want to do once you click on that button? On Thu, Aug 27, 2015 at 12:44 PM, 江之源 <jiangzhiy...@liulishuo.com> wrote: > I have a request that i ergodic my one directive and store my > sub-directive name in an Array[String] by Scala. Then i use > z.angularBind("list", fileList) to bind the sub-directive names to "list" , > i give it to the %angular paragraph to show the names, and it's successful. > But when i wanna to add ng-click to every button to show every > sub-directive and bind this name which i selected to my next scala > paragraph, i failed. i can't find a way to bind my need variable. > Can anyone helps me,below is my simple codes : > > %spark > import java.io.File > val rootDir = new File("/home/pipeline/autoScorerLLS") > val fileList = rootDir.listFiles.map(_.toString.split("/").last) > z.angularBind("list",fileList) > %angular > <div ng-repeat="n in list track by $index"> > <div class="btn btn-success" >{{n}}</div> > </div> > > you can modify the FIle path to try. > and Right now i tried javascript codes to finish the sub-directive display > function. But i still have no idea to bind the selected name to scala, > below is the codes: > > %spark > import java.io.File > val rootDir = new File("/home/pipeline/autoScorerLLS") > val fileList = rootDir.listFiles.map(_.toString.split("/").last) > z.angularBind("list",fileList) > > %angular > <div ng-repeat="n in list track by $index"> > <div class="btn btn-success" onClick="myAlert.call(this)">{{n}}</div> > </div> > <div id="targetDOM"> > </div> > > <script> > window.myAlert = function() { > document.getElementById('targetDOM').innerHTML = this.innerHTML; > } > </script> > > Thanks everyone! > >