Angular.js: Why the form is undefined in the scope?

Created on 20 Jan 2014  路  5Comments  路  Source: angular/angular.js

Hello, i have a trouble whit calling the form object from the scope (i got undefined), here's the fiddle

http://jsfiddle.net/k3dUG/

i want to take the form without a controller nested on the ng-if div, and without stop using ng-if, i need this work with this same structure, any helps is appreciated.

thanks in advance!

Most helpful comment

The reason why is because ngIf creates a child scope

Another way you could make this work (using ng-if and not ng-show) is like this: http://jsfiddle.net/PW2rQ/

All 5 comments

The reason why is because ngIf creates a child scope

Another way you could make this work (using ng-if and not ng-show) is like this: http://jsfiddle.net/PW2rQ/

right, thanks but without modify the structure, i have passed the form var as a parameter of the function (http://jsfiddle.net/k3dUG/1/), this works, but i don't know if is a recommended way.

You're passing the variable from the child scope to a function in the parent scope, which isn't really a super helpful thing to do, necessarily. It depends what you're trying to do

http://jsfiddle.net/zqS79/ another way to do this without changing the markup structure

Anyways, I'm going to close this because this is more of a support question. If you need to ask questions like this, check out the irc channel, stackoverflow, or the mailing list

ok, anyway your http://jsfiddle.net/zqS79/ help's me.
thanks a lot :)

Was this page helpful?
0 / 5 - 0 ratings