How to use angular directive in VisualForce My directive html page

<apex:page showHeader="false" sidebar="false" standardStylesheets="false" applyHtmlTag="false">
    <div class="address-container">
        <p data-once-text="addr.company"></p>
        <p><span class="once-addr" data-once-text="addr.city"></span>, <span class="once-addr" data-once-text="addr.state"></span></p>
        <p><a href="javascript:;" details="addr" shipment-details = ''>View</a> <span>|</span> <a href="javascript:;" ng-click="removeAddress(acc.id, addr.id)">Remove</a></p>

My directive call

 mydirective.directive('shipmentAddress', ['CartService', function(CartService){
            scope: true,
            replace: true,
            templateUrl: 'apex/shipment_addresses_tplhtml',
            controller: function($scope){
                this.addressInfo = $scope.addr;
                $scope.removeAddress = function(accountId, addrId){
                    if(confirm('Are you sure you want to remove this shipping address?')){
                        CartService.deleteCartAddress(accountId, addrId).then(function(response){

in my index.html

 <tr class="addresses">
    <td shipment-address  ng-repeat="addr in acc.addresses" ng-if="addr.added == true"></td>

But I am getting error in SaleForce/VisualForce as Attribute name "shipment-address" associated with an element type "td" must be followed by the ' = ' character.

  • Is your index.html a VF page? I'm a little confused.
    – Phil B
    Commented Jul 5, 2014 at 14:57

1 Answer 1


The visualforce parser insists on a few odd things. One of which is that every property has to be something="something".

For example, shipment-address="x" will work fine. The x can be a literal x, or frequently I use true.

If you're new to VF, it'll also insist on a closing / for the HTML input tag and require

  • yeah I've noticed this too, is this part of how its parsed or just enforcing an XHTML syntax?
    – Phil B
    Commented Jul 6, 2014 at 13:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .