Tweaking the way new customer form error messages are display for latest version of AngularJS

This commit is contained in:
Rob Harrington
2016-06-16 16:32:10 +10:00
parent a909f0ddb8
commit 2a4737147f
2 changed files with 9 additions and 8 deletions

View File

@@ -3,18 +3,19 @@ angular.module("admin.customers").directive 'newCustomerDialog', ($compile, $inj
scope: true
link: (scope, element, attr) ->
scope.CurrentShop = CurrentShop
scope.submitted = null
scope.submitted = false
scope.email = ""
scope.errors = []
scope.addCustomer = (valid) ->
scope.submitted = scope.email
scope.addCustomer = ->
scope.new_customer_form.$setPristine()
scope.submitted = true
scope.errors = []
if valid
if scope.new_customer_form.$valid
Customers.add(scope.email).$promise.then (data) ->
if data.id
scope.email = ""
scope.submitted = null
scope.submitted = false
template.dialog('close')
, (response) ->
if response.data.errors