1.2.9 • Published 7 years ago

angular-material-simple-components v1.2.9

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

Angular Material Simple Components

A module that simplify design elements based on Angular Material Design. With additional features that are similar to NgMessage to input validations.

Demo

Demo Hosted on github.io Click Here

Quick Links:

Installation

Npm

Change to your project's root directory.

# To install latest
npm install angular-material-simple-components

# To install latest and update package.json
npm install angular-material-simple-components --save

setup

install modules

# install npm modules
npm install

Include the angular-material-simple-components module as a dependency in your application.

angular.module('myApp', ['ngMaterial', 'angular-material-simple-components']);

Usage

Example Template

 <form name="myForm">
    <text-input icon="text_fields" label="Text Input Sample" ng-model="input" is-required="true" max-length="50">
        <error-message error="required">This field is required.</error-message>
    </text-input>
    
    <number-input icon="attach_money" label="Number Input Sample" ng-model="number" is-required="true" max-length="50">
        <error-message error="required">This field is required.</error-message>
    </number-input>
    
    <image-input name="image" ng-model="image" is-required="true">
        <error-message error="required">This field is required.</error-message>
        <error-message error="image">This field must be a valid image.</error-message>
    </image-input>
    
    <search-input label="Search Input Sample" name="search" ng-model="search" ></search-input>
    
    <html-text-area-input name="htmlTextArea" icon="text_fields" label="Html Input Sample" ng-model="htmlTextArea" is-required="true" max-length="50">
        <error-message error="required">This field is required.</error-message>
    </html-text-area-input>
</form>

Documentation

Directives

errorMessage

errorMessage is a simplification of ngMessage, it is used inside of the components

<error-message [error=""] [message=""]>
... [message]
</error-message>

Attributes

ParamTypeDetails
errorstring=The key of error. (key of $error object on an ngModel instance)
messagestring=The message to show when the error happens (You can put error inside the component or on the attribute message)

Components

textInput

textInput is a component to input text

<text-input [name=""] [label=""] [icon=""] [type=""] [ng-model=""] [is-disabled=""] [is-required=""] [no-float=""] [max-length=""] [min-length=""] >
... 
</text-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
iconstring=Icon class name based on Material Icons. When present, will put a icon on left of component.
typestring=The type of component (text, password or email, url).
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
no-floatboolean=When present, placeholder attributes on the input will not be converted to floating labels.
max-lengthnumber=Sets maxlength validation error key if the value is longer than maxlength.
min-lengthnumber=Sets minlength validation error key if the value is shorter than minlength.

numberInput

numberInput is a component to input numbers

<number-input [name=""] [label=""] [icon=""] [ng-model=""] [is-disabled=""] [is-required=""] [no-float=""] [max=""] [min=""] [step=""] >
... 
</number-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
iconstring=Icon class name based on Material Icons. When present, will put a icon on left of component.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
no-floatboolean=When present, placeholder attributes on the input will not be converted to floating labels.
maxnumber=Sets max number value allowed.
minnumber=Sets min number value allowed.
stepnumber=Sets step increment value.

searchInput

searchInput is a component to input text

<search-input [name=""] [label=""] [ng-model=""] [is-disabled=""] [is-required=""] [no-float=""] [max-length=""] [min-length=""] >
... 
</search-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
max-lengthnumber=Sets maxlength validation error key if the value is longer than maxlength.
min-lengthnumber=Sets minlength validation error key if the value is shorter than minlength.

textAreaInput

textAreaInput is a component to input long texts

<text-area-input [name=""] [label=""] [icon=""] [ng-model=""] [is-disabled=""] [is-required=""] [no-float=""] [max-length=""] [min-length=""] >
... 
</text-area-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
iconstring=Icon class name based on Material Icons. When present, will put a icon on left of component.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
no-floatboolean=When present, placeholder attributes on the input will not be converted to floating labels.
max-lengthnumber=Sets maxlength validation error key if the value is longer than maxlength.
min-lengthnumber=Sets minlength validation error key if the value is shorter than minlength.

htmlTextAreaInput

htmlTextAreaInput is a component to input, edit and preview long html texts

<html-text-area-input [name=""] [label=""] [icon=""] [ng-model=""] [is-disabled=""] [is-required=""] [max-length=""] [min-length=""] >
... 
</html-text-area-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
iconstring=Icon class name based on Material Icons. When present, will put a icon on left of component.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
max-lengthnumber=Sets maxlength validation error key if the value is longer than maxlength.
min-lengthnumber=Sets minlength validation error key if the value is shorter than minlength.

imageInput

imageInput is a component to input Image

<image-input [name=""] [ng-model=""] [is-disabled=""] [is-required=""] [preview=""]  [show-buttons=""] [allow-webcam=""] [override-class=""] [fallback-img=""] [take-picture-text=""] [sel-picture-text=""] [remove-picture-text=""] >
... 
</image-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
previewboolean=Allow preview the input image.
show-buttonsboolean=Allow show the control buttons of the input (Select and Remove Image).
allow-webcamboolean=Allow take picture from user webcam.
override-classstring=Css class to put on preview image div.
fallback-imgstring=Url of fallback image to present when user don't have a valid image or not selected one.
take-picture-textstring=Button text, default: "Take a photo".
sel-picture-textstring=Button text, default: "Select a picture".
remove-picture-textstring=Button text, default: "Remove picture".

timeInput

timeInput is a component to input time

<time-input [name=""] [label=""] [icon=""] [ng-model=""] [is-disabled=""] [is-required=""] [no-float=""] >
... 
</time-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
iconstring=Icon class name based on Material Icons. When present, will put a icon on left of component.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
no-floatboolean=When present, placeholder attributes on the input will not be converted to floating labels.

dateInput

dateInput is a component to input date

<date-input [name=""] [label=""] [icon=""] [ng-model=""] [is-disabled=""] [is-required=""] [max-date=""] [min-date=""] [filter-date=""] [date-mask=""]>
... 
</date-input>

Attributes

ParamTypeDetails
namestring=Property name of the form under which the control is published.
labelstring=The label of the input.
ng-modelstring=The ngModel directive.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.
is-requiredboolean=Sets required attribute if set to true.
max-datedate=The max date allowed in input.
min-datedate=The min date allowed in input.
filter-datefunction=The function to used to filter the allowed dates in the input, function(testDate : date) : boolean.
date-maskstring=String mask based on ngMask, default: '19/39/9999'.

mdPagination

mdPagination is a component to pagination

<md-pagination [items-per-page=""] [current-page=""] [n-items=""] [is-disabled=""]>
... 
</md-pagination>

Attributes

ParamTypeDetails
items-per-pagenumber=Quantity of items to show per page.
n-itemsnumber=Total of items to paginate.
current-pagenumber=The current page to show, this bind two way.
is-disabledboolean=If the expression is truthy, then the disabled attribute will be set on the element.

Services

CameraService

CameraService is a service to use user webcam

Methods

showCamera

Show the dialog to take a picture

Parameters

ParamTypeDetails
options.titlestring=dialog title
options.heightstring=dialog height
options.widthstring=dialog width

Returns

ParamDetails
promisea promise that will return the photo (base 64)
1.2.9

7 years ago

1.2.8

7 years ago

1.2.7

7 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago