Fixed js error. For some reason form generator was unable to get the scope for js-tree after changes related to source_regions. Added a way to pass in scope.

This commit is contained in:
Chris Houseknecht 2013-11-21 17:36:03 +00:00
parent 376d59dfcc
commit 0af2980d10
2 changed files with 9 additions and 3 deletions

View File

@ -894,7 +894,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
}
scope.removeChoicesComplete = scope.$on('choicesReady', function() {
generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form', breadCrumbs: false });
generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form',
breadCrumbs: false, scope: scope });
generator.reset();
// Retrieve detail record and prepopulate the form

View File

@ -68,9 +68,14 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies', 'Utilities'])
else {
element.html(this.build(options));
}
if (options.scope) {
this.scope = options.scope;
}
else {
this.scope = element.scope();
}
this.scope = element.scope(); // Set scope specific to the element we're compiling, avoids circular reference
// From here use 'scope' to manipulate the form, as the form is not in '$scope'
$compile(element)(this.scope);
if (!options.buildTree && !options.html) {