7.1: Profile Template
The MemberEditComponent template will be very similar to the MemberDetailComponent template - just with some changes to allow for editing.
Updating MemberEditComponent
Add Styles
Add the styles from the member-detail.component.scss to member-edit.component.scss
Add Dynamic Button and Warning Message
Let's add some dynamic functionality. We'll disable the 'Save Changes' button if there are no changes to the form.
We'll also make the alert box hidden unless there have been changes made.
Add updateUser() Method
Now, we need to stub out the updateUser() method we're using to submit our form.
We don't have the method on our backend, so for now - we can just console.log our form and verify that it's working correctly.
In member-edit.component.ts
, add the following method and inject alertify
into the constructor:
Our submit button is outside of our form, so we need to "hook up" the button and the form.
Toggle the Information Panel
Our information box informing the user that changes have been made doesn't disappear after hitting submit at the moment.
Let's do this with ViewChild - the template is considered to be a child of the component. We can access the properties of the form with @ViewChild()
. :
Last updated