After reading about it I understand that the html loaded through ajax is not bind to my angular app. I've tried 1.000 things but can't get 'customers-invoice.html' to understand angular. Any ideas will be much appreciated.
<body ng-cloak ng-app="myApp">
<main id="main">
<div ng-controller='Ctrl'>
<a ng-click="openInvoice(data.invoiceRef)" class="btn">View</a>
</div>
</div>
</body>
var app = angular.module('myApp', []);
app.controller('Ctrl', function($scope, $compile) {
$scope.invoice = {}
$scope.openInvoice = function(ref) {
$scope.invoice.ref = ref;
var html = $('#main');
html.load('customers-invoice.html')
$compile(html)($scope);
}
}