Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
refactor(macTime): Full refactor to make the component more usable
Browse files Browse the repository at this point in the history
Wrapper and icon have been removed to leave mac-time only to be a text type input. This allows mac-time to be easily used in a form for validation and other form benefits. Isolated scope has also been removed allowing user to add other directives to the component.
This also means instead of mac-time-model, it is now ng-model. mac-time-placeholder is replaced with either mac-placeholder or placeholder attribute.

BREAKING CHANGES:
mac-time input element is not in a mac-date-time wrapper and is now top level.
mac-time-model has been removed in favor of ng-model
mac-time-placeholder has been removed
mac-time isolated scope has been removed
  • Loading branch information
adrianlee44 committed Jun 19, 2014
1 parent b719519 commit 2d61c26
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 232 deletions.
31 changes: 26 additions & 5 deletions docs/directives/time.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,44 @@

Time
===
A directive for creating a time input field
A directive for creating a time input field. Time input can use any `ng-` attributes support by text input type.


### Parameters
**mac-time-model**
**ng-model**
Type: `String`
Assignable angular expression to data-bind to
Clearing model by setting it to null or '' will set model back to default value

**mac-time-placeholder**
**name**
Type: `String`
Placeholder text of the text input (default --:--)
Property name of the form under which the control is published

**mac-time-disabled**
**required**
Type: `String`
Adds `required` validation error key if the value is not entered.

**ng-required**
Type: `String`
Adds `required` attribute and `required` validation constraint to
the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
`required` when you want to data-bind to the `required` attribute.

**ng-pattern**
Type: `String`
Sets `pattern` validation error key if the value does not match the
RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for
patterns defined as scope expressions.

**ng-change**
Type: `String`
Angular expression to be executed when input changes due to user interaction with the input element.

**ng-disabled**
Type: `String`
Enable or disable time input


**mac-time-default**
Type: `String`
If model is undefined, use this as the starting value (default 12:00 PM)
Expand Down
12 changes: 8 additions & 4 deletions docs/html/directives/time.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<h1 id="time">Time</h1>
<p>A directive for creating a time input field </p>
<p>A directive for creating a time input field. Time input can use any <code>ng-</code> attributes support by text input type. </p>
<h3 id="parameters">Parameters</h3>
<p><strong>mac-time-model</strong><br>Type: <code>String</code><br>Assignable angular expression to data-bind to<br>Clearing model by setting it to null or &#39;&#39; will set model back to default value </p>
<p><strong>mac-time-placeholder</strong><br>Type: <code>String</code><br>Placeholder text of the text input (default --:--) </p>
<p><strong>mac-time-disabled</strong><br>Type: <code>String</code><br>Enable or disable time input </p>
<p><strong>ng-model</strong><br>Type: <code>String</code><br>Assignable angular expression to data-bind to<br>Clearing model by setting it to null or &#39;&#39; will set model back to default value </p>
<p><strong>name</strong><br>Type: <code>String</code><br>Property name of the form under which the control is published </p>
<p><strong>required</strong><br>Type: <code>String</code><br>Adds <code>required</code> validation error key if the value is not entered. </p>
<p><strong>ng-required</strong><br>Type: <code>String</code><br>Adds <code>required</code> attribute and <code>required</code> validation constraint to<br> the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of<br> <code>required</code> when you want to data-bind to the <code>required</code> attribute. </p>
<p><strong>ng-pattern</strong><br>Type: <code>String</code><br>Sets <code>pattern</code> validation error key if the value does not match the<br> RegExp pattern expression. Expected value is <code>/regexp/</code> for inline patterns or <code>regexp</code> for<br> patterns defined as scope expressions. </p>
<p><strong>ng-change</strong><br>Type: <code>String</code><br>Angular expression to be executed when input changes due to user interaction with the input element. </p>
<p><strong>ng-disabled</strong><br>Type: <code>String</code><br>Enable or disable time input </p>
<p><strong>mac-time-default</strong><br>Type: <code>String</code><br>If model is undefined, use this as the starting value (default 12:00 PM) </p>
8 changes: 4 additions & 4 deletions docs/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ block append content
h3 Example
.docs-example
mac-time(
mac-time-id = "input-start-time"
mac-time-model = "myStartTime"
id = "input-start-time"
ng-model = "myStartTime"
mac-time-default = "11:59 PM"
)
pre.prettyprint.
&lt;mac-time
mac-time-id=&quot;input-start-time&quot;
mac-time-model=&quot;myStartTime&quot;
id=&quot;input-start-time&quot;
ng-model=&quot;myStartTime&quot;
mac-time-default=&quot;11:59 PM&quot;&gt;
&lt;/mac-time&gt;

Expand Down
Loading

0 comments on commit 2d61c26

Please sign in to comment.