I have a directive that is replaced by a form. That form is bound to a vm.customer
object.
Assuming this directive will be used in multiple parts of the application and each vm.customer
object should have it's own scope, what are some ways that the parent controller can access its vm.customer
object?
// Directive
(function() {
'use strict';
angular
.module('rugapp')
.directive('customer', customer);
function customer() {
return {
scope: {
},
restrict: 'E',
templateUrl: 'rugapp/directives/customer-directive.html',
replace: true,
controller: 'CustomerController',
controllerAs: 'vm'
};
}
})();
// View
<div class="scrollable">
<div class="scrollable-content section">
<customer></customer>
</div>
</div>
// Parent Controller
(function() {
'use strict';
angular
.module('rugapp')
.controller('CreateScheduleController', CreateScheduleController);
function CreateScheduleController() {
var vm = this;
activate();
function activate() {
}
}
})();