title: How to create dynamically $scope based on input parameter in angularjs
body: <p>HTML</p>
  
  <pre><code>&lt;div ng-repeat-start="param in parameters"&gt;
      &lt;div ng-show="param.expensecolumn_type == tab.title"&gt;
          &lt;div class="col-md-3" ng-show="param.inputtype == 'Textbox'"
               ng-repeat="para in param.columnsdata"&gt;
              &lt;md-input-container ng-disabled="" class="md-block inputcontainer"
              &gt;
                  &lt;label&gt;{{para.ColumnName}}&lt;/label&gt;
                  &lt;input ng-model="models[tab.title].values[para.ColumnName]" maxlength="16"/&gt;
              &lt;/md-input-container&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;md-button ng-click="save_details(tab.title)"
             class="md-raised md-warn"&gt;Submit
      &lt;md-tooltip&gt;Submit&lt;/md-tooltip&gt;
  &lt;/md-button&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$scope.models = {};
  $scope.save_details = function(type){
      var str = "";
      var value = str.concat($scope,'.models.',type,'.values');
      $scope.data_todb = value;
      console.log($scope.data_todb)    
  }
  </code></pre>
  
  <p>MY JSON data - (Now $scope.models looks like this on ng click)</p>
  
  <pre><code>  {
    "RENT": {
      "values": {
        "rent_qty": "34",
        "rent_amount": "100"
      }
    },
    "HOUSEHOLD": {
      "values": {
        "Account_no": "w",
        "name": "w"
      }
    }
  }
  </code></pre>
  
  <p>EXPECTED OUT PUT JSON </p>
  
  <pre><code>{
    "rent_qty": "34",
    "rent_amount": "100"
  }
  </code></pre>
  
  <p>I trying to creating dynamically $scope variable on call to <code>ng-click</code> directive .The variable (type) in <code>$scope.save_details()</code> function may change based on input. so i tried creating dynamic scope based on variable .please guide me to find the solution thanks in advance. </p>