javascript - Displaying updated address from the scope variable using the directive -
i have directive called displayaddress takes in address .i using isolalted scope , code performs checking if addres fields blank or not , builds object whihc displaying on view have put view in code problem arises when use 1 way binding code throws error parse string having error:syntax syntax error .
return { templateurl: () => { return "/app/templates/common/displayaddress" }, restrict: "e", replace: true, scope: { address: '=' }, controller: "displayaddresscontroller", controlleras: "vm" } <div> <div class="m-space"> <i class="fa fa-map-marker"></i> <span data-ng-if="address.addresstype" data-ng-bind="address.addresstype"></span> <span>{{vm.addresstostring()|| ""}}</span> </div> <div class="row-m-box"> <span class="m-box" data-ng-if="address.phone1"><i class="fa fa-phone"></i> <span class="label-content" data-ng-bind="address.phone1"></span></span> <span class="m-box" data-ng-if="address.phone2"> <i class="fa fa-phone"></i> <span class="label-content" data-ng-bind="address.phone2"></span></span> <span class="m-box" data-ng-if="address.fax"> <i class="fa fa-fax"></i> <span class="label-content" data-ng-bind="address.fax"></span></span> <span class="m-box" data-ng-if="address.email"> <i class="fa fa-envelope"></i> <span class="label-content" data-ng-bind="address.email"></span></span> </div>
i want make directive least number of watchers , single way bind .what can make directive quality code
Comments
Post a Comment