javascript - SyntaxError: Unexpected token { in directive angular js -


i getting error in accessing scope variable in html file {{model}}

in html file

<div shipping-detail-directive type="billingaddress"> </div> 

here requirement want user fill value in 'type' attribute , have access in shippingdetaildirective.html file

i know doing wrong in accessing model of directive.

in shippingdetaildirective.html

<div class="order-content shipping-cost-confirm" ng-repeat="x in order">               <div><span>name</span><label>:</label><span>{{x.{{model}}.firstname}} {{x.{{model}}.lastname}}</span></div>             <div><span>company</span><label>:</label><span>{{x.{{model}}.companyname}}</span></div>             <div><span>address</span><label>:</label><span>{{x.{{model}}.address}}</span></div>             <div><span>city</span><label>:</label><span>{{x.{{model}}.city}}</span></div>             <div><span>state / province</span><label>:</label><span>{{x.{{model}}.state}}</span></div>             <div><span>zip code</span><label>:</label><span>{{x.{{model}}.zipcode}}</span></div>             <div><span>country</span><label>:</label><span>{{x.{{model}}.country}}</span></div>             <div><span>office tel</span><label>:</label><span>{{x.{{model}}.officetelephone}}</span></div>             <div><span>home tel</span><label>:</label><span>{{x.{{model}}.hometelephone}}</span></div>             <div><span>fax</span><label>:</label><span>{{x.{{model}}.fax}}</span></div>             <div><span>mobile phone</span><label>:</label><span>{{x.{{model}}.mobileno}}</span></div>             <div><span>e-mail address</span><label>:</label><span>{{x.{{model}}.email}}</span></div>             <div class="edit-forgot float-r o-view-btn">                 <input type="button" ui-sref="app.billing" value="edit address" class="white-bg"></div> </div> 

and here directive

app.directive('shippingdetaildirective', function() {      return{        scope: {          model: '='        },         templateurl: 'templates/shippingdetaildirective.html',         controller: 'shippingctrl',            link : function (scope, elem, attrs, controller) {                 scope.model = attrs.type;              }      }  }); 

so can please tell me there other way this.

i'm guessing want replace {{x.{{model}}.firstname}} {{x[model].firstname}}, we'd have see data know.


Comments