Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    New in Angular 1.3: Updates to forms

    Kent C. DoddsKent C. Dodds
    angularjsAngularJS

    With the release of AngularJS 1.3, we get some handy additions to forms, including a submitted state and the ability to bind input field names to an expression.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Angular 1.3 does a couple of interesting things to forms. The first, a form has a submitted state. If we see down here, myForm.$submitted is false. In our markup, we have myForm, which is bound to that name on the scope and $submitted. This $submitted is new.

    If I go up here, say, "Hello," and then submit, you can see now that this submitted is now true. One other thing that I think is key is now this name property is interpolatable. It can be interpolated. It's passed through the parser before myField is attached to the myForm on the scope.

    We can say, "fieldName." Actually, let's put that on the view model. Good practice there. viewModel.fieldName equals myField. Now, everything works great. These are welcome changes to forms.