Commit 14384b02 14384b020930a92790a498c05f2e0e9703d975e4 by Vincent Peybernes

#2 - Publish

1 parent 436f66a1
......@@ -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
......
node_modules
tests
.gitlab-ci.yml
karma.conf.js
.gitignore
src
gulpfile.js
\ No newline at end of file
# 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;
};
}
]);
```