1

https://embed.plnkr.co/oCd2WrzJjFtvgsGdHrdV3b/

Hello , I created Login page and Register page. But I need to add an additional functionality of confirm password. I am pretty confused in handling this with my controllers.

can anyone help me in validation part.

When I give Ng-match or directives , it is not compatible with my existing controller. Either it states Registration successful in case of wrong password or else my view is just empty in browser.

Tangle Designer
  • 25
  • 1
  • 11
  • 1
    this question has been asked before here: http://stackoverflow.com/questions/14012239/password-check-directive-in-angularjs – Sarantis Tofas Feb 27 '16 at 14:23
  • When I give Ng-match or directives , it is not compatible with my existing controller. Either it states Registration successful in case of wrong password or else my view is just empty in browser. – Tangle Designer Feb 27 '16 at 15:03

2 Answers2

2

Use following ng-match directive

http://ngmodules.org/modules/ng-match

Paresh Gami
  • 4,777
  • 5
  • 23
  • 41
  • When I give Ng-match or directives , it is not compatible with my existing controller. Either it states Registration successful in case of wrong password or else my view is just empty in browser. – Tangle Designer Feb 27 '16 at 15:03
1

plnkr.co/edit/LRXKpql1AxmGNcTWifGS?p=preview

I solved the issue you faced with confirmPassword. I'm just saying where you made the mistake 1)password name in ng-modal and name in "required data-password-verify" at confirm password should match when you compare two passwords. 2)Please have a look at console first,then you understand where you did a mistake.Console clearly saying two issues i.e app is not defined at passwordVerify.js and User service not defined. 3)I changed passwordVerfiy directive to register controller and I commented userservice wherever i find.Because I have not seen anywhere you are using Userservice class.Both the files(user.service and user.service,localstorage) are empty

I would be more happy if my code resolve your problem. Thank you

Ashok Reddy
  • 174
  • 8
  • Yes thank you. I will follow up using console to check out my errors. – Tangle Designer Feb 28 '16 at 13:03
  • Ashok Reddy.. I have one more doubt. http://plnkr.co/edit/zl4prZVBIRzp1CzpbyE3?p=preview I have local storage to store my datas locally , what if I want to move datas to server side using JSOn. Namely My JSon is .REGISTER CANDIDATE ------------------------ URL : http://localhost:8080/Registration?request={JSONREQUEST} ----- – Tangle Designer Feb 29 '16 at 08:26
  • REQUEST: -------- {"json": {"request": {"servicetype":"21", "functiontype":"1001", "data":{ "email":"abc@gmail.com", "password":"12345", "retypepassword":"12345" } } } } RESPONSE : ---------- { "json":{ "response":{ "servicetype":"21", "functiontype":"1001", "statuscode":"0", "statusmessage":"Success" } } } – Tangle Designer Feb 29 '16 at 08:28
  • 1
    I didn't get you exactly.But as far as I understand you need to send data to server as JSON. for this use $http.post('api/register', JSON.stringify(formData)). in your user service. It will stringify you data as JSON automatically – Ashok Reddy Feb 29 '16 at 08:52
  • yes You are correct , I need to send datas from registration page to server . So dont I have any use with URL : localhost:8080/Registration?request={JSONREQUEST} . – Tangle Designer Feb 29 '16 at 09:34
  • You can send data in url by using $stateparams,But it's not secure.To the best of my knowledge better to go with JSON data than $stateparams. – Ashok Reddy Feb 29 '16 at 09:59