1

I have read and understood the use of a forms $pristine/$dirty property to detect changes to a form's data.

However, in trying to keep my UI friendly, I have split my various data fields over a number of tabs (I'm using angular-bootstrap). As far as I can tell I have to create a separate 'form' element for each tab and use a controller to test across all the tabs' $pristine states in order to determine the overall pristinity (is that a word?).

i.e.

<tab>
   <form name="a">...</form>
</tab>
<tab>
   <form name="b">...</form>
</tab>

which means I have to test a.$pristine && b.$pristine to determine the overall pristinity. This becomes laborious when there are many tabs involved.

I have tried

<form name="allForm">
   <tab>..</tab>
   <tab>..</tab>
   <tab>..</tab>
</form>

but this doesnt work. I guess the element breaks the form's 'unity'.

Any ideas on how to get a single $pristine (or $dirty) propoerty for a multi-tabbed tabset ?

1
  • This maybe breaking because of new scope being created in the tab. Commented Jan 23, 2014 at 12:53

1 Answer 1

0

It seems to be working for me: http://jsfiddle.net/QqBYR/

A change, compared to yours (unless it was a typo) is that the <form> actually wraps the entire <tabset>:

<form name="theForm">
    <tabset>
        <tab>
            <input ng-model="..." />
        </tab>
        ...
    </tabset>
</form>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.