frontend

Is it possible to get minlength value from formcontrol?

女生的网名这么多〃 提交于 2021-02-19 01:34:04
问题 So i have my form validation. And my question is can i get for example a minlength value which i passed at creating formControl? I havent found any information. This is my dumb component and i want to get minlength value to pass to information. Now i need to pass it via @Input(). title: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(20)]] . <div class="validation-window"> <p *ngIf="errors.required"> {{field}} required </p> <p *ngIf="formControl.hasError('minlength')"

Is it possible to get minlength value from formcontrol?

走远了吗. 提交于 2021-02-19 01:33:29
问题 So i have my form validation. And my question is can i get for example a minlength value which i passed at creating formControl? I havent found any information. This is my dumb component and i want to get minlength value to pass to information. Now i need to pass it via @Input(). title: ['', [Validators.required, Validators.minLength(4), Validators.maxLength(20)]] . <div class="validation-window"> <p *ngIf="errors.required"> {{field}} required </p> <p *ngIf="formControl.hasError('minlength')"

how can i use inline plugin inner title for chart js?

ぐ巨炮叔叔 提交于 2021-02-11 14:54:24
问题 i am creating a JavaScript web page with two doughnut charts. to create the charts i'm using one function and calling it twice with different data for each chart. however when i do that the text in the middle of the doughnut chart is being changed for both charts not only for current one. how can i write the text individually for each? this is my code function chart(dummynames, dummyValues, dummyColors, percentage, id) { //dummy names, dummy values and dummy colors are arrays new Chart

Using map in the function is mutating the main array

非 Y 不嫁゛ 提交于 2021-02-11 14:49:08
问题 I'm new to JS and trying to use map array.prototype.map() function in my code. I need to add one property to the array's each element without changing the main object structure. I have this array of objects const nav = [ { name: 'Home', title: 'Dashboard', icon: 'home', }, { name: 'About', icon: 'layout-auto', title: 'About', }, { name: 'Applications', icon: 'applications', title: 'Applications', }, ]; after mapping through this array it also chaging main nav array's objects. const mappedNav

How to use Context API to pass down a state while using a Router in React JS

自作多情 提交于 2021-02-11 14:11:04
问题 I have a Context API file setup which has a state and a function which fetches data from an API and sets the state, and i want to pass the state down to my other components. In my App.js, I am using React-Router to specify the routes. How do i pass the state down to these components using Context API, whilst using React-Router. My ApiContext.js file looks like this : import React, {useState, createContext } from 'react'; export const ApiContext = createContext(); export const ApiProvider =

CSS - Chrome Mobile - Page move up when keyboard appears

假如想象 提交于 2021-02-10 18:41:55
问题 I implemented a web page with ReactJS, I have a form with some fields, in Chrome for computers it works ok, but when I go in the form using a mobile like a Tablet or Smartphone, when the keyboard appears all the page move to up and the menu of my page is hiden by the navigation bar of the Chrome navigator. Here is the flow: I have the next meta in the head: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" /> The

CSS Scroll Snap Points with navigation (next, previous) buttons

柔情痞子 提交于 2021-02-08 15:45:10
问题 I am building a carousel , very minimalist, using CSS snap points . It is important for me to have CSS only options , but I'm fine with enhancing a bit with javascript ( no framework ). I am trying to add previous and next buttons to scroll programmatically to the next or previous element. If javascript is disabled, buttons will be hidden and carousel still functionnal. My issue is about how to trigger the scroll to the next snap point ? All items have different size , and most solution I

(HTML) linked CSS stylesheet in other folder but same directory doesn't work

放肆的年华 提交于 2021-02-08 11:08:43
问题 I am a total beginner and am trying to create a website and store the CSS stylesheet in a different folder that the HTML files, but in the same directory . I put this in the header tag of my HTML: <link rel="stylesheet" type="text/css" media="screen" href="./style/stylesheet.css" /> but it doesn't work. The file is in the folder "style" in the same directory as my HTML. It works, when I have the CSS file and the HTML file in the same folder and link to it in the same way with href="stylesheet

Create Component Dynamically with parameters

别来无恙 提交于 2021-02-07 14:41:13
问题 I have a component which is dynamically created with ComponentFactoryResolver this.container.clear(); let factory = this.resolver.resolveComponentFactory(DynamicComponent); this.componentRef = this.container.createComponent(factory); template: '...<child-component [param1]="param1"></child-component>...'; The problem is DynamicComponent's template has child component and input bindings. Is there a way to pass parameters to child component when creating the component dynamically? 回答1: Yes like

Create Component Dynamically with parameters

给你一囗甜甜゛ 提交于 2021-02-07 14:40:55
问题 I have a component which is dynamically created with ComponentFactoryResolver this.container.clear(); let factory = this.resolver.resolveComponentFactory(DynamicComponent); this.componentRef = this.container.createComponent(factory); template: '...<child-component [param1]="param1"></child-component>...'; The problem is DynamicComponent's template has child component and input bindings. Is there a way to pass parameters to child component when creating the component dynamically? 回答1: Yes like