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!

Reply via email to