Posts

Showing posts with the label Angular js form validation

Get Height and Width of Image when upload

<script type="text/javascript">  var _URL = window.URL || window.webkitURL;  $('#structure_product_image').on('change', function() { //pass here file field id    var image, file;    if ((file = this.files[0])) {      image = new Image();      image.onload = function() {        $("#error_message").text("");        if (this.width <= 700) {          $("#error_message").text("Width should be greater than 700 pixel!") //id where you want to display text        }        else if (this.height <= 600){          $("#error_message").text("Height should be greater than 600 pixel!")        }        else if (this.height >= this.width){          $("#error_message").text("Height should not be greater than Width")        }        if($("#error_message").text() == ""){          $("#save_product").prop("disabled" , false)      

you should install 'babel-loader@7'. || babel version

If you are Getting any error in compiling main.js or app.js or in Entry file of React App You have to Update Babel versions and dependency npm install -D babel-loader @babel/core @babel/preset-env webpack And change config file options: {           presets: ['@babel/preset-env']         }

how to run rails console on other port

Open Console or Terminal When we do rails s  it will run by default on 3000 port number if you want to run on specific port then rails s -p <port-number> Hit local host on by remote address  Go to browser            And type in the url bar or search bar - 127.0.0.1:3000            If your address is like this localhost:3000 Here 3000 is a port number if you are running localhost on another port then remote address will be 127.0.0.1:<your current port number>

How do I pass an AngularJS variable into an HTML tag?

How do I pass an AngularJS variable into an HTML tag? There are three two option to pass angular variable into html. One is pass that variable into ng-modal. ex-<input type=”text” ng-modal=”angular_variable”>            2. Is pass that variable using one way binding. ex- html_tage {{angular_variable}} close_html_tag    <p>{{ name }}</p>

Angular js hidden form validation work

Angular Js  form validation   1-Create a Form                   <form name="userForm" novalidate > 2-Add Bootstrap Class for Showing Error Messages to that Div              <div class="form-group"  ng-class="  {'has-error':! userForm.email.$valid &&(!userForm.$pristine || userForm.$submitted),  'has-success':userForm.email.$valid && (!userForm.$pristine || userForm.$submitted)       }       "> replace userForm with your form name. 3-Now Add the input field into your form                 <input type="email"  name="email"  class="form-control"  ng-model="main.email"                            ng-minlength="5"  ng-maxlength="20"  required="required"> here we are adding required  validation. minimum length 5 validation . maximum length 20 validation. 4-Now Finally we add validation one by one 1-when fo

AngularJs form validation in deep

AngularJs form validation || client side validation by angular js 1-Create a Form                   <form name="userForm" novalidate > 2-Add Bootstrap Class for Showing Error Messages to that Div              <div class="form-group"  ng-class="  {'has-error':! userForm.email.$valid &&(!userForm.$pristine || userForm.$submitted),  'has-success':userForm.email.$valid && (!userForm.$pristine || userForm.$submitted)       }       "> replace userForm with your form name. 3-Now Add the input field into your form                 <input type="email"  name="email"  class="form-control"  ng-model="main.email"                            ng-minlength="5"  ng-maxlength="20"  required="required"> here we are adding required  validation. minimum length 5 validation . maximum length 20 validation. 4-Now Finally we