পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Thursday, February 9, 2017

Angular Material - Inputs

The md-input-container an Angular directive, is a container component to contains any <input> or <textarea> element as a child. md-input-container also supports error handling using the standard ng-messages directives and animates the messages using ngEnter/ngLeave events or the ngShow/ngHide events.

Attributes

S.N.Parameter & Description
1md-maxlength
The maximum number of characters allowed in this input. If this is specified, a character counter will be shown underneath the input. The purpose of md-maxlength is exactly to show the max length counter text. If you don't want the counter text and only need "plain" validation, you can use the "simple" ng-maxlength or maxlength attributes.
2aria-label
Aria-label is required when no label is present. A warning message will be logged in the console if not present.
3placeholder
An alternative approach to using aria-label when the label is not PRESENT. The placeholder text is copied to the aria-label attribute.
4md-no-autogrow
When present, textareas will not grow automatically.
5md-detect-hidden
When present, textareas will be sized properly when they are revealed after being hidden. This is off by default for performance reasons because it guarantees a reflow every digest cycle.

Example

The following example showcases the use of md-input-container directive to showcase uses of inputs.
am_inputs.htm
<html lang="en" >
   <head>
      <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
   <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
   <style>
        
      </style>
      <script language="javascript">
         angular
            .module('firstApplication', ['ngMaterial'])
            .controller('inputController', inputController);

         function inputController ($scope) {
           $scope.project = {
              comments: 'Comments',    
           };
         }                 
      </script>        
   </head>
   <body ng-app="firstApplication"> 
      <div id="inputContainer" class="inputDemo" ng-controller="inputController as ctrl" ng-cloak>
         <md-content layout-padding>
            <form name="projectForm">
               <md-input-container class="md-block">
                  <label>User Name</label>
                  <input required name="userName" ng-model="project.userName">
                  <div ng-messages="projectForm.userName.$error">
                     <div ng-message="required">This is required.</div>
                  </div>
               </md-input-container>
               <md-input-container class="md-block">
                  <label>Email</label>
                  <input required type="email" name="userEmail" ng-model="project.userEmail"
                     minlength="10" maxlength="100" ng-pattern="/^.+@.+\..+$/" />
                  <div ng-messages="projectForm.userEmail.$error" role="alert">
                     <div ng-message-exp="['required', 'minlength', 'maxlength', 'pattern']">
                        Your email must be between 10 and 100 characters long and should be a valid email address.
                     </div>
                  </div>
               </md-input-container>
               <md-input-container class="md-block">
                  <label>Comments</label>
                  <input md-maxlength="300" required name="comments" ng-model="project.comments">
                  <div ng-messages="projectForm.comments.$error">
                     <div ng-message="required">This is required.</div>
                     <div ng-message="md-maxlength">The comments has to be less than 300 characters long.</div>
                  </div>
               </md-input-container>     
            </form>
         </md-content>
      </div>
   </body>
</html>

Result

Verify the result.

No comments:

Post a Comment