Angular: File2GUI_Add_More_Buttons
http://angularjs.org/
by rishi007bansod
HTML
<script src="http://code.angularjs.org/angular-1.0.0rc8.js"></script>
<script type="text/ng-template" id="tree_item_renderer.html">
<!-- Change Background color once option is selected -->
<div ng-show="!(data.name=='UserDictionaryRecord')" ng-style="(!(data.sel_option === optionTemplates[0]) && !(data.functionToApply === blisterPackTemplates[0])&&!(data.dummy === 'Dummy'))&&{'background-color': '#3BB9FF'}">
<button id="toggleMessage" class="button buttonitem" ng-click="data.toggle=!data.toggle">
{{data.name}}
</button>
<!--,{{data.showOptions}},{{data.functionToApply}},{{data.sel_option}},{{data.dummy}}-->
<select ng-model="data.sel_option"
ng-change="updateDisplay()"
data-ng-options="optionTemplate as optionTemplate.name for optionTemplate in optionTemplates"
ng-init="data.sel_option = optionTemplates[0]"
ng-show="(data.showOptions=='true') && data.toggle"
>
</select>
<select ng-model="data.functionToApply"
ng-change="updateDisplay()"
data-ng-options="blisterPackTemplate as blisterPackTemplate.name for blisterPackTemplate in blisterPackTemplates"
ng-init="data.functionToApply = blisterPackTemplates[0]"
ng-show="(data.showOptions=='true') && data.toggle"
>
</select>
<!--<span class="nowrap" ng-show="(data.showOptions=='true') && data.toggle">Dummy:</span>-->
<input type="text" ng-show="(data.showOptions=='true') && data.toggle" ng-change="updateDisplay()" ng-model="data.dummy" value="Dummy" />
</div>
<ul>
<li ng-repeat="data in data.nodes" ng-include="'tree_item_renderer.html'"></li>
</ul>
</script>
<div ng-app="Application" ng-controller="TreeController">
<textarea rows="4" cols="100" readonly ng-model="displayFileContent" style="background-color:lightblue"></textarea>
<textarea rows="1" cols="100" readonly ng-model="displayUpdatedRowContent" style="background-color:#3BB9FF;"></textarea>
<table class="colored">
<tr>
<td>
<input type="file"...
CSS
ul {
list-style: circle;
}
ul.ex{
list-style: circle;
background-color: lightblue;
width: 740px;
height: 740px;
overflow: scroll;
}
li {
margin-left: 20px;
}
.nowrap {
white-space: nowrap;
}
table.colored {border-style: ridge;
border-width: medium;
background-color: #98AFC7;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
color: black;
padding: 0px 0px;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 4px 2px;
cursor: pointer;
}
.buttonitem {background-color: lightblue;} /* Blue */
JavaScript
angular.module("myApp", []).
controller("TreeController", ['$scope', function($scope) {
$scope.tree = [{
name: "UserDictionaryRecord",
functionToApply: "",
sel_option: "",
dummy: "Dummy",
toggle: false,
showOptions:"true",
nodes: []
}];
var outDataString = "";
function GenerateMetaFile(temp_tree, temp_parent_list, len){
for(var k = 0; k < len; k++)
{
list_copy_for_children = temp_parent_list.slice();
list_copy_for_children.push(temp_tree[k].name)
//temp_parent_list.push(temp_tree[k].name)
//for(var tt in temp_parent_list)
if((temp_tree[k].functionToApply.name!="Select Function")&&(temp_tree[k].dummy!="Dummy"))
{
if(temp_tree[k].sel_option.name == "this")
{
//console.log('inside this.................')
for(i = 2; i < (temp_parent_list.length-1); i++ )
{
outDataString = outDataString + temp_parent_list[i]+","
}
//Adding Outer Key....
outDataString = outDataString + temp_parent_list[(temp_parent_list.length-1)]+",";
//Adding Inner Key....
outDataString = outDataString + temp_tree[k].name+",";
//Adding Selected Function....
outDataString = outDataString + temp_tree[k].functionToApply.name+",";
//Adding Dummy Variable Value....
outDataString = outDataString + temp_tree[k].dummy+"\n";
}
else if((temp_tree[k].sel_option.name == "0")||(temp_tree[k].sel_option.name == "1"))
{
//console.log('inside 0/1.................')
for(i = 2; i < temp_parent_list.length; i++ )
{
outDataString = outDataString + temp_parent_list[i]+","
}
//Adding Outer Key....
outDataString = outDataString + temp_tree[k].name+",";
...