Hi Sander and thanks by your time.
Yes I have tryed it, the result was the same.
Yesterday nigth I found the answer ...
The issue is about the compilation of the requested template:
$templateRequest(value, true).then(function(response) {
if (angular.isDefined(attrs.replace))
elem.replaceWith($compile(angular.element(response))(scope));
else
elem.append($compile(angular.element(response))(scope));
});
The secuence is: create a element, compile and add/replace the element in
the DOM. Debuging angular.js I can see that NgModelDirective is who
comunicate with FormDirective controller to set the $pristine, $touch, ...
NgModelDirective has a '^?form' as require to comunicate with parent form.
Well, when I compile the element the template has no form parent and
ngModel don't find the form and not set $error, $pristine, $touch, ...
The solution is add element to the DOM and then compile it:
$templateRequest(value, true).then(function(response) {
var responseElem = angular.element(response);
if (angular.isDefined(attrs.replace))
elem.replaceWith(responseElem);
else
elem.append(responseElem);
$compile(responseElem)(scope)
});
Thanks
El lunes, 13 de julio de 2015, 8:19:29 (UTC+2), Sander Elias escribió:
>
> Hi Javier,
>
> This might sound a bit weird, but did you try it with append in stead of
> replacewith?
>
> Regards
> Sander
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.