How can I extend the input field length in the form to make it appear more compact?

<div formGroupName="xxxx" class="form-row">
  <div class="form-group col-md-3">
    <mat-form-field class="row-styling">
      <mat-label> Mobile Number </mat-label>
      <input
        matInput
        phoneNumberOnly
        [value]="f.xxx['controls'].cellPhone.value | phone"
        (blur)="validatePhone($event.target)"
        maxlength="12"
        formControlName="cellPhone"
        name="yyy"
      />
    </mat-form-field>
  </div>
  <div></div>
</div>

I attempted to add a width of 200px in the platform field but it did not have any effect. Check out the image here.

Answer №1

Once you have included the CSS class called row-styling, simply insert the following lines of code into your .scss file to make it functional.

.row-styling {
    input {
       width:200px;
    }
 }

If you are still not achieving the desired width, consider adding !important after 200px in your .scss file.

Answer №2

Make sure to include the word essential in your input control style. Your own style should take precedence over Bootstrap's style, like this:

<div formGroupName="xxxx" class="form-row">
          <div class="form-group col-md-3 ">
            <mat-form-field class = "row-styling">
              <mat-label> Cell Phone </mat-label>
              <input style="width: 200px!important;" matInput phoneNumberOnly 
                [value]="f.xxx['controls'].cellPhone.value | phone"  
                (blur)="validatePhone($event.target)" 
                maxlength="12" formControlName="cellPhone" name="yyy" />
              </mat-form-field>
           </div>
    <div> 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The image is refusing to adjust according to CSS settings

Why won't the image adjust to the CSS? I'm trying to move the picture to the side a bit by adding margin, but it's not working out. Any ideas? HTML <div class="la"> <center> <h1> GREET THE TEAM </h ...

What is the best way to include a specific stylesheet for Blackberry Curve devices based on certain conditions

Is there a method to include a custom style-sheet specifically for the 'Blackberry curve 2007'? Or perhaps implement a redirect that can identify this device and direct them to a different .html page? I'm looking to create a simplified versi ...

Ways to display or conceal multiple div elements using JavaScript

A group of colleagues and I are currently collaborating on a project to create a website showcasing our research. We have incorporated 1 page that contains detailed descriptions of six different subjects: system biology, proteomics, genomics, transcripto ...

What could be the reason for the crash caused by ngModel?

The usage of [(ngModel)] within a *ngFor-Loop is causing an endless loop and crashing the browser. This is how my HTML looks: <div class="container"> <div class="row" *ngFor="let item of controlSystemTargetViewModel.values; let index = i ...

Upgrading from Angular 10 to 13 resulted in an error that required adding 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas'. Although this fix was implemented, the issue still persists and the application remains broken

Here are a few examples of errors: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurred in the template of component ShochatactivestreamviewShellComponent. Error: src/app/money_makers/shochat_guts/shochat_content_creato ...

Detecting property changes in Angular 2: A step-by-step guide

I've created a basic class structure like so: export class MessagesPage { @ViewChild(Content) content: Content; public message = ''; public messages = []; public state = 'general'; } Can I implement a way wit ...

Creating a secure Angular pipe to prevent DomSanitizer from removing content

I am currently utilizing Angular 9 to fetch movie data using the Youtube API. As a result, I had to develop a custom pipe in order for my links to function correctly within HTML Below is the code snippet for the pipe: import { Pipe, PipeTransform } fro ...

The function slice is not a method of _co

I'm attempting to showcase the failedjobs array<any> data in a reverse order <ion-item *ngFor="let failjob of failedjobs.slice().reverse()"> An issue arises as I encounter this error ERROR TypeError: _co.failedjobs.slice is not a fu ...

Is there a method to prevent Apple OS from applying its default styles to form fields, scrollbars, and other elements?

Is it possible to remove the default Apple styling (such as the blue glow) applied to focused DOM elements in OS X or iOS using CSS or JavaScript? I've searched online but couldn't find any information on this topic. I'm starting to think t ...

The combination of Spring Boot and Angular's routeProvider is a powerful

I have been working on a project using Spring Boot, REST, and AngularJS. While I successfully implemented the back end with REST, this is my first time using AngularJS. Despite watching numerous tutorials and following them step by step, I am still facing ...

Issue encountered: Inoperable binding when employing ko.mapping with two distinct models

I've been struggling to implement a drop-down select in conjunction with a table on a page using knockout bindings. The issue arises when I try to use the mapping options in the knockout binding plugin – either the drop-down or the table behaves inc ...

Iterating over an array and displaying elements on the webpage

Struggling to access an array and loop through it, but only able to print out one element instead of all. Need a hint on how to solve this issue. See my code below: let toppingsCount; const burger = document.createElement('div'); const toppingsD ...

What is the best way to utilize a single component for validating two other components?

I am encountering an issue with my components setup. I have three components in total: GalleryAddComponent, which is used to add a new element, GalleryItemComponent, used to edit an element, and FieldsComponent, the form component utilized by both GalleryA ...

Using two type arguments, create a feature selector with ngrx

Currently, I am delving into the world of ngrx with Angular v6.0.9 and AngularCLI v6.0.8. In an example application, there is a demonstration on creating a root level createFeatureSelector with two type arguments: example-app/app/reducers/index.ts ..... ...

Can a CSS Grid layout be achieved without prior knowledge of image sizes?

I am working on a project where I am pulling images from Reddit and aiming to showcase them in a gallery-style grid. I have tried using a flex display and resizing the images to match dimensions, but unfortunately not all images have the same dimensions ...

The use of URL embedded parameters in @angular/http

Currently, I am utilizing a backend system that accepts search query parameters in both the ?-notation and the url-embedded format. I understand that I can use tools like URLSearchParams/RequestOptionsArgs to send requests to . However, I am curious about ...

IE encountered an invalid character

While working on a JavaScript function, I encountered an issue with a string variable. Specifically, when running the page in IE with this script, I receive an error message indicating an invalid character at the following line: let displayString = `${s ...

What is the process for converting an array of objects into an array of form groups?

I am looking to utilize the array function of the formbuilder to handle formcontrol arrays. I have a custom object array that I need to integrate into a FormArray, but it seems to only accept FormGroup as arguments. How can I convert my array of custom obj ...

Unleashing the Power of RXJS: Discovering the Magic of connecting Events and Tapping into Executions with retrywhen

Whenever Angular attempts to establish a connection, I aim to display "Connecting". Although I can achieve this on the initial connection, I am uncertain about how to accomplish it when using retryWhen(). It is essential for me to intercept the actual exec ...

You are able to use a null type as an index in angular.ts(2538) error message occurred

onClick() { let obj = { fName: "ali", LName: "sarabi", age: "19", } let fieldName = prompt("field"); alert(obj[fieldName]); } I encountered an issue with the code above where alert(obj[fieldName] ...