option create select

when you select option, if selected value have child script create new select

by Jasmin Kurtić

HTML

<div ng-app="autoDrops" ng-controller="testController as test">
      <div ng-controller="simpleController as simple">
          <a href="" ng-click="test.addValue(value, test.testValue)">Add</a>
          <a href="" ng-click="test.addValue2(value2, test.testValue2)">Add2</a>
      </div>
       <a href="" ng-click="test.addValue(value, test.testValue)">Add</a>
       <a href="" ng-click="test.addValue2(value2, test.testValue2)">Add2</a>
    <p>
    {{test.testValue}}
    </p>  
     <p>
     {{test.testValue2}}
     </p> 
<div>

JavaScript

var autoDrops = angular.module('autoDrops', []);
autoDrops.controller('testController', function ($scope) {
	this.testValue = 0;
  $scope.value = 1;
  this.addValue = function(value, testValue){
  	//why function not work, if i remove this?
  	testValue = testValue + value;
  }
  $scope.value2 = {value:"1"};
  this.testValue2 = [];
  
  this.addValue2 = function(value, testValue2){
		//this function work with this
  	testValue2.push(value);
  }
});
autoDrops.controller('simpleController', function ($scope) {
 $scope.value = 1;
		$scope.value2 = {value:"1"};
});