angularjs - Cannot access attribute that is a directive inside another directive's template -


my custom directive "testapp". access value of "file-model" in template, contain file object uploaded. whatever not able value, displaying "undefined". please suggest ways solve problem.

app.directive('testapp', function ($compile) {     return {         restrict: 'e',         scope: {             text: '@',             filem: '=filemodel'                      },         require:'filemodel',         replace:true,         template: '<div class="col-xs-4" style="padding-left:0px"><div class ="jumbotron" id="section1"><input type="text" name="id" id="section{{incr}}" placeholder="section heading" class="form-control"><form id="addliform1"><div ng-repeat="i in range(fileincr) track $index"><input type="text"  name="file{{incr}}{{$index+1}}" id="file{{incr}}{{$index+1}}"  class="form-control" placeholder="file name" style="width:50%" ><input type = "file"  id="path{{incr}}{{$index+1}}" file-model = "file{{incr}}{{$index+1}}"></div></form><a id="addmore" ng-click="addfile()" href="#">add more file</a><a id="addmoresec1" ng-click="add()" class="pull-right" href="#" ng-show="showvalue">add more section</a></div></div>',         controller: function ($scope, $element,$window) {              $scope.incr=$window.globalincr;             $scope.fileincr=$window.globalfileincr;             $scope.showvalue=$window.globalsectionvalue;             $scope.add = function () {                 $window.globalsectionvalue=false;                 $window.globalincr+=1;                 $window.globalfileincr=1;                 var el = $compile("<testapp></testapp>")($scope);                 $element.parent().append(el);                 //alert($window.globalfileincr);                 //alert($element.parent().parent());             };              $scope.range=function(n)             {                 return new array(n);             }              $scope.addfile=function(){             alert($scope.filem);                  $scope.fileincr+=1;                 $window.counterobject[$scope.incr] = $scope.fileincr;             };         }     }; }); 


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -