Code Monkey home page Code Monkey logo

angularjs-tc-no-validation's Introduction

angularjs-tc-no-validation

AngularJS için TC kimlik numarası doğrulama directive'i

Birinci örnek sadece directive ile TC no doğrulaması yapar ve input her değiştiğinde durum mesajı gösterilir.

İkinci örnekte angular-ui-mask kullanılmıştır. Bu durumda öncelik ui-mask'indir.

  • İlk önce mask ile 11 haneli 99999999999 pattern'ı doğrulanmalıdır. Doğrulandıktan sonra TC no directive'i çalışır.
  • ui-mask kendi placeholder'ını kullanır.
  • ui-mask'in ayarları tcNoValidation directive'inin çalışma şeklini etkileyebilir.

Algoritma

  • Kural-1: Tüm karakterleri rakam olmalıdır.
  • Kural-2: TC Kimlik numarası 11 basamaktan oluşmalıdır.
  • Kural-3: İlk hanesi 0 olamaz.
  • Kural-4: İlk 9 basamak arasındaki algoritma, 10. basmağı vermelidir.
  • İşlem: 1. 3. 5. 7. ve 9. hanelerin toplamının 7 katından, 2. 4. 6. ve 8. hanelerin toplamı çıkartıldığında, elde edilen sonucun 10′a bölümünden kalan, yani Mod10′u bize 10. haneyi verir.
  • Kural-5: İlk 10 basamak arasındaki algoritma, 11. basamağı vermelidir.
  • İşlem: 1. 2. 3. 4. 5. 6. 7. 8. 9. ve 10. hanelerin toplamından elde edilen sonucun 10′a bölümünden (Mod 10) kalan, bize 11. haneyi verir.

Uyarı

Bu directive inputa girilen değeri algoritmik olarak doğrular. Girilen değerin gerçekten birine ait olduğu veya geçerli olup olmadığı bilgisini NVI SOAP API ile öğrenmek mümkün. TC no kontrolü için API bizden tc no, ad, soyad, ve doğum yılı bilgilerini istiyor.

Ayrıca form validation sadece client tarafında değil aynı zamanda backend tarafında da yapılmalıdır.

angularjs-tc-no-validation's People

Contributors

egemenmede avatar relliv avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.