angularjs - Template is not included inside directive -
i need include table few tr element based on template prototype/views/prototype/booking/templates/table-row.html
. use custom directive indicate point template should inserted. define rownum
show value should used while pasting template. don't anything. how make work?
prototypeapplication.directive('tablerowtemplate', function() { return { restrict: 'e', transclude: true, scope: { rownum:'@' }, templateurl: 'prototype/views/prototype/booking/templates/table-row.html' }; });
booking
<table><tr><td>static entry</td></tr> <tablerowtemplate rownum="1"></tablerowtemplate> <tablerowtemplate rownum="2"></tablerowtemplate> </table>
prototype/views/prototype/booking/templates/table-row.html
<tr> <td> <div class="form-group first-name"> <label>first name</label> <input type="text" ng-class="{'input-valid': isvalidfield('firstname', persons[{{rownum}}].firstname)}" name="firstname" class="form-control input-name" ng-model="persons[{{rownum}}].firstname" ng-focus="focused('inputfirstname', {{rownum}})" placeholder="-"> </div> </td> </tr>
update
no errors in console. <tablerowtemplate rownum="1"></tablerowtemplate>
not excist in html dom when rendered
update 2
when try generate few cell
s got one:
<cell rownum="0"></cell> <cell rownum="1"></cell> <cell rownum="2"></cell> <cell rownum="3"></cell> prototypeapplication.directive('cell', function() { return { restrict: 'e', replace: true, transclude: true, scope: { rownum:'@' }, templateurl: 'prototype/views/prototype/booking/templates/table-row.html' }; });
does mean setting rownum="3"
makes template have {{rownum}} equals 3? possible value of attribute tell template value inject itself? how fix it?
it'a angular issue :( read here: https://github.com/angular/angular.js/issues/1459
i tried myself write simple directive , behavior odd!
Comments
Post a Comment