Angular: Cyclic Dependency

Issue Why is currentdate in this.currentdate.getTime() coming back as undefined? newlisting = this.formBuilder.group({ availabledate: new FormGroup({ xyz: new FormControl() },[this.mainservice.getcurrenttime.bind(this)]) }) @Injectable({providedIn: ‘root’}) export class MainService { constructor(){} currentdate: Date = new Date(); getcurrenttime(control: FormGroup){ console.log(this.currentdate.getTime()) <~~ Generates Error!!! if(condition){

Continue reading

angular2 Validator Error: Template parse errors:(…)

Issue I have problem. In console i can see “Error: Template parse errors:(…)”. I’m use: “@angular/common”: “2.0.0-rc.6”, “@angular/compiler”: “2.0.0-rc.6”, “@angular/core”: “2.0.0-rc.6”, My form looks like <form name=”authForm” novalidate=”” ng-submit=”login()” class=”md-padding” [ngFormModel]=”form”> <div layout=”column” class=”layout-column”> <div class=”md-form” style=”margin-bottom: 64px; margin-top: 20px”>

Continue reading

AngularJS date validation

Issue How can I do date control validation in an AngularJS form for the following code ? <label for=”startDate” class=”control-label”>Start Date:</label> <div class=””> <input type=”date” class=”form-control” id=”startDate” ng-model=”startDate” /> </div> <label for=”endDate” class=”control-label”>End Date:</label> <div class=””> <input type=”date” class=”form-control” id=”endDate”

Continue reading

AngularJS date validation

Issue How can I do date control validation in an AngularJS form for the following code ? <label for=”startDate” class=”control-label”>Start Date:</label> <div class=””> <input type=”date” class=”form-control” id=”startDate” ng-model=”startDate” /> </div> <label for=”endDate” class=”control-label”>End Date:</label> <div class=””> <input type=”date” class=”form-control” id=”endDate”

Continue reading

Angularjs validation issue for password field

Issue Here is my angularjs code for the password field : <input type=”password” class=”form-control” name=”password” ng-model=”signup.registerPassword” ng-minlength=”8″ > <small class=”errorMessage” data-ng-show=”signupForm.registerPassword.$dirty && signupForm.registerPassword.$error.minlength”> Minimum 8 characters.</small> <small class=”errorMessage” data-ng-show=”signupForm.registerPassword.$dirty && signupForm.registerPassword.$error.required”> Enter password again.</small> when I type the password below

Continue reading

ng-pattern doesn't show $error.pattern

Issue I have script here and ng-pattern works correctly because scope.subnet is shown in Output only after input matches pattern. But ng-show doesn’t display any error if ng-pattern is not matched <body ng-contoller=”myConfigGenCtr”> <form novalidate name=”myForm”> <div class=”form-group”> <label for=”hostname”>Firewall

Continue reading

How to cancel debounce in ng-model-options in AngularJS

Issue <form name=”editForm”> Title<input ng-model=”task.title” type=”text” name=taskTitle ng-model-options=”{ updateOn: ‘default’ ,debounce{‘default’:2000000} }”> <a ng-click=”UpdateTask(task.title)”>SAVE</a> <a ng-click=”editForm.$rollbackViewValue();”>DISCARD</a> </form> Since the debounce value is very long, when I click “DISCARD”, the ng-model will not reflect its changes. However, what I want is

Continue reading

My AngularJS validation does not work. I have added ng-required

Issue My AngularJS validation does not work. I have added ng-required. Please let me know where I am missing <ng-form id=”frmdisbursementScheduleMaintenance”> <div style=”padding-bottom: 8px;”> <button id=”cm-SaveBtn” name=”cm-SaveBtn” type=”button” ng-click=”submitted=true”>Save</button> <button id=”cm-RefreshBtn” name=”cm-RefreshBtn” type=”button”>Refresh</button> </div> <div> <table> <tr> <td><span class=”VNAVLabel”>Process Begin

Continue reading

My AngularJS validation does not work. I have added ng-required

Issue My AngularJS validation does not work. I have added ng-required. Please let me know where I am missing <ng-form id=”frmdisbursementScheduleMaintenance”> <div style=”padding-bottom: 8px;”> <button id=”cm-SaveBtn” name=”cm-SaveBtn” type=”button” ng-click=”submitted=true”>Save</button> <button id=”cm-RefreshBtn” name=”cm-RefreshBtn” type=”button”>Refresh</button> </div> <div> <table> <tr> <td><span class=”VNAVLabel”>Process Begin

Continue reading

Angular validators and ng-maxlength use

Issue I’ve got the following div, which I want to add the bootstrap’s class “has-error” if the input length is over 50 characters. This is the HTML: <div class=”form-group” ng-class=”{has-error:[formData.titulo.$error]}”> <label for=”inputTitulo”>Título</label> <input type=”titulo” class=”form-control” id=”inputTitulo” maxlength=”50″ ng-maxlength=”50″ ng-model=”formData.titulo”> </div>

Continue reading

Angular form is $valid when all inputs are blank, why?

Issue My form is showing up as valid even though all of my input fields are blank. I have the required keyword in the input fields. <!DOCTYPE html> <html ng-app=”myApp”> <head> <link rel=”stylesheet” href=”https://cdnjs.cloudflare.com/ajax/libs/materialize/0.96.1/css/materialize.min.css”> <script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js”></script> <script type=”text/javascript” src=”/components/angular/angular.min.js”></script> <script

Continue reading

How to invoke AngularJS $compile from outside AngularJS module/code?

Issue Suppose I have HTML with AngularJS module/controller as follows: angular .module("myModule", []) .controller("myController", [‘$scope’, ‘$compile’, function ($scope, $compile) { $scope.txt = "<b>SampleTxt</b>"; $scope.submit = function () { var html = $compile($scope.txt)($scope); angular.element(document.getElementById("display")).append(html); } }]); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <body ng-app="myModule" >

Continue reading

regex for multiple IPs comma separated with or without subnet

Issue I have regex for IPv4 address: ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$ and i have regex for IPv4 CIDR range : ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(/([0-9]|[1-2][0-9]|3[0-2]))$ the issue is how should i repeat it using comma separated pattern: XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX/XX, XX.XX.XX.XX, XX.XX.XX.XX/X , XX.XX.XX.X test data– 123.123.13.11, 1.0.0.0,

Continue reading

Angular simple validation not working

Issue Here is some plunker I have created. I cant understand why it is not working. Here is the JS: angular.module(‘demo’, [ ]).controller(‘MainCtrl’, function($scope) { $scope.name = “Vlad”; $scope.age = 11; $scope.sendTest = function() { console.log($scope.name.$valid); console.log($scope.age.$valid); } }); Here

Continue reading

Angular setValidity not working when HTML is produced in a Directive

Issue I have dynamic html that i make in a directive, and it includes an input element with validation. Example HTML produced with error message: <input id=”bob” class=”personCheckbox” name=”bob” type=”checkbox” value=”bob” ng-model=”foobar” validate-foo/> <span style=”color:red” ng-show=”myForm.bob.$error.summary”>Need Summary</span> <input type=”text” name=”summary-bob”

Continue reading

AngularJS form input name validation not working in ngrepeat

Issue name=”number-{{$index+1}}” working in ng-repeat at the same time myform.number-{{$index+1}}.$invalid does not working for the form Demo: http://plnkr.co/edit/Z3EmpHu8w2iZcZko9dJv?p=preview var app = angular.module(‘plunker’, []); app.controller(‘MainCtrl’, function($scope) { $scope.choices = [{no: ‘1234567890’}, {no: ‘0987654321’}]; $scope.numberAdd = function() { $scope.choices.push({‘no’:”}); }; $scope.numberRemove =

Continue reading

AngularJS form validation issues

Issue I am trying to do a simple form validation using angular js. But it doesnt seems to work and I am not getting what I am missing. HTML <form role=”form” class=”ng-pristine ng-valid” name=”registerForm”> <fieldset> <div class=”form-group”> <input class=”form-control” placeholder=”First

Continue reading

how to plot training error and validation error vs number of epochs?

Issue how to plot training error and validation error vs number of epochs? train_data = generate_arrays_for_training(indexPat, filesPath, end=75) validation_data=generate_arrays_for_training(indexPat, filesPath, start=75) model.fit_generator(generate_arrays_for_training(indexPat, filesPath, end=75), #end=75),#It take the first 75% validation_data=generate_arrays_for_training(indexPat, filesPath, start=75),#start=75), #It take the last 25% #steps_per_epoch=10000, epochs=10) steps_per_epoch=int((len(filesPath)-int(len(filesPath)/100*25))),#*25),

Continue reading

Weird behaviour for my CNN validation accuracy and loss function during training phase

Issue Here is the architecture of my network : cnn3 = Sequential() cnn3.add(Conv2D(32, kernel_size=(3, 3), activation=’relu’, input_shape=input_shape)) cnn3.add(MaxPooling2D((2, 2))) cnn3.add(Dropout(0.25)) cnn3.add(Conv2D(64, kernel_size=(3, 3), activation=’relu’)) cnn3.add(MaxPooling2D(pool_size=(2, 2))) cnn3.add(Dropout(0.25)) cnn3.add(Conv2D(128, kernel_size=(3, 3), activation=’relu’)) cnn3.add(Dropout(0.2)) cnn3.add(Flatten()) cnn3.add(Dense(128, activation=’relu’)) cnn3.add(Dropout(0.4)) # 0.3 cnn3.add(Dense(4, activation=’softmax’))

Continue reading

When using a custom validator, formBuilder.group is displayed as deprecated

Issue I have built my PasswordValidator as follows: // Function to compare password with confirmPassword export function ConfirmedValidator(controlName: string, matchingControlName: string) { return (formGroup: FormGroup) => { const control = formGroup.controls[controlName]; const matchingControl = formGroup.controls[matchingControlName]; if (matchingControl.errors && !matchingControl.errors.confirmedValidator) {

Continue reading

Show errors in JavaScript in HTML5 form

Issue I have a HTML5 form with required fields: <form id=”my_form”> <input type=”text” name=”myfield1″ required> <input type=”text” name=”myfield2″ required> <input type=”text” name=”myfield3″ required> <button type=”button” id=”my_button”>Check</button> </form> Also, I have the following jQuery code: $(‘#my_button’).on(‘click’, function() { if ($(‘#my_form’).checkValidity() ==

Continue reading

Optional field validation in Yup schema

Issue I’m using react-hook-form with yup for my form validation and want some fields to be optional (null). Following their documentation, I’m using nullable() and optional() but it is still getting validated: export const updateAddressSchema = yup.object({ address: yup .string()

Continue reading

Is there a way to update VS' CSS validation to 3.0?

Issue I’m getting warnings about CSS3.0 properties like text-overflow. Is there a way to validate against 3.0? HTML5 and CSS3 support is coming to VS2010 in SP1. Link And now its here. http://visualstudiogallery.msdn.microsoft.com/7211bcac-091b-4a32-be2d-e797be0db210/view/Reviews/0?showReviewForm=True Solution Apparently, you can define your own

Continue reading