Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Vincent Peybernes
/
angular-matrix-validation
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
14384b02
...
14384b020930a92790a498c05f2e0e9703d975e4
authored
2017-01-13 01:21:57 +0100
by
Vincent Peybernes
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
#2
- Publish
1 parent
436f66a1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
3 deletions
.gitlab-ci.yml
.npmignore
README.md
.gitlab-ci.yml
View file @
14384b0
...
...
@@ -19,6 +19,21 @@ build:
test
:
stage
:
test
script
:
-
ls
-
ls node_modules/.bin
-
npm run test
\ No newline at end of file
-
npm run test
publish
:
stage
:
publish
only
:
-
tags
artifacts
:
paths
:
-
dist/
-
package.json
-
README.md
-
LICENCE
-
CHANGELOG.md
environement
:
name
:
npm
url
:
https://www.npmjs.com/package/angular-matrix-validation
scripts
:
-
npm publish
\ No newline at end of file
...
...
.npmignore
0 → 100644
View file @
14384b0
node_modules
tests
.gitlab-ci.yml
karma.conf.js
.gitignore
src
gulpfile.js
\ No newline at end of file
README.md
0 → 100644
View file @
14384b0
# Angular Matrix Validation
[
![build status
](
http://gitlab.techniv.fr/WestCoastSwing/RelativePlacement/badges/master/build.svg
)
](http://gitlab.techniv.fr/WestCoastSwing/RelativePlacement/commits/master)
This module provide an addon directive for form to validate matrix form.
## Example
```
html
<body
ng-app=
"test"
ng-controller=
"ctrlTest"
>
<ng-form
name=
"mForm"
matrix-validator
data-all=
"validator"
>
<table>
<tr
ng-repeat=
"row in matrix"
ng-init=
"rowId = $index"
>
<td
ng-repeat=
"item in row track by $index"
>
<input
ng-model=
"row[$index]"
type=
"number"
data-row=
"rowId"
data-col=
"$index"
name=
"item{{rowId}}_{{$index}}"
ng-class=
"{error: mForm['item'+rowId+'_'+$index].$invalid}"
>
</td>
</tr>
</table>
</ng-form>
</body>
```
```
javascript
angular
.
module
(
'test'
,
[
'matrixValidation'
]).
controller
(
'ctrlTest'
,
[
'$scope'
,
(
$scope
)
=>
{
$scope
.
matrix
=
[
[
0
,
0
,
0
],
[
0
,
0
,
0
],
[
0
,
0
,
0
]
];
$scope
.
test
=
2
;
/**
* @param {mixed[][]} matrix The matrix with the value of form fields
* @param {null[][]} validationMatrix The validation matrix template.
* @returns {boolean[][]}
*/
$scope
.
validator
=
(
matrix
,
validationMatrix
)
=>
{
// Do something to fill validationMatrix with true/false
// to validate matrix.
// validationMatrix is give to help you to construct it.
// It have the same dimension than matrix.
// But you to return it.
return
validationMatrix
;
};
}
]);
```
Please
register
or
sign in
to post a comment