I need to compile a directive because it needs an ID that comes back from the DB, but can't seem to get that to persist through to the directive.
$scope.orderInfo = {
orderId: 'lkdfj232jh'
};
$scope.compile = function() {
var html = $compile('<apps orderId="orderInfo.orderId"></apps>')($scope);
$('#apps').append(html);
};
return {
templateUrl: 'apps.html',
restrict: 'E',
scope: {
orderId: '='
},
controller: function($scope) {
console.log($scope.orderId);
}
}
orderId is always undefined inside directive.