us-formly-templates
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "us-formly-templates", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/juliofabiane/us-formly-templates", | ||
@@ -4,0 +5,0 @@ "description": "Extensão com templates para usar formly com bootstrap", |
{ | ||
"name": "us-formly-templates", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Extensão com templates para usar formly com bootstrap", | ||
@@ -5,0 +5,0 @@ "scripts": { |
angular.module('usFormlyTemplates', [ | ||
'formly', | ||
'formly', | ||
'formlyBootstrap' | ||
@@ -294,3 +294,70 @@ ]) | ||
}); | ||
//Image Upload | ||
//Multi Checkbox Inline | ||
formlyConfigProvider.setType({ | ||
name: 'imageUpload', | ||
extends: 'input', | ||
template: ` | ||
<div class="col-md-12"> | ||
<div class="form-group"> | ||
<label>{{to.label}}</label> | ||
<input type="file" us-file-upload="fileUpload" ng-model="model[options.key]"/> | ||
</div> | ||
<div class="hbox hbox-auto-xs"> | ||
<div class="col"> | ||
<div class="wrapper-sm b-a bg-white m-r-xs m-b-xs"> | ||
<div class="bg-light" style="height:200px"> | ||
<img-crop | ||
image="fileUpload" | ||
result-image="myCroppedImage" | ||
result-image-size="160" | ||
area-type="{{cropType}}"> | ||
</img-crop> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col"> | ||
<div class="inline bg-white wrapper-sm b-a"> | ||
<div class="bg-light"> | ||
<img ng-src="{{myCroppedImage}}" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="btn-group m-t"> | ||
<label class="btn btn-default" ng-model="cropType" btn-radio="'circle'">Circulo</label> | ||
<label class="btn btn-default" ng-model="cropType" btn-radio="'square'">Quadrado</label> | ||
</div> | ||
</div>`, | ||
wrapper: ['bootstrapHasError'], | ||
controller: ['$scope', function ($scope) { | ||
$scope.myCroppedImage = ''; | ||
$scope.cropType = "circle"; | ||
}] | ||
}); | ||
} | ||
]); | ||
]) | ||
.directive('usFileUpload', function() { | ||
return { | ||
restrict: 'A', | ||
require: 'ngModel', | ||
scope: { | ||
usFileUpload: '=' | ||
}, | ||
link(scope, element) { | ||
element.on('change', function(e) { | ||
if (!e.target.files || !e.target.files[0]) { | ||
return; | ||
}; | ||
var reader = new FileReader(); | ||
reader.onload = function (evt) { | ||
scope.$apply(function(scope) { | ||
scope.usFileUpload = evt.target.result; | ||
}); | ||
}; | ||
reader.readAsDataURL(e.target.files[0]); | ||
}); | ||
} | ||
}; | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11653
361