I am trying to integrate filestack webpicker in my webpage. The requirment is to use angularjs.
I can add script tag direct in my cshtml file. But i want to have all the scripting part in angularjs.
<div class="js_file File__block" data-ng-controller="fileController">
<script src="//static.filestackapi.com/filestack- js/1.x.x/filestack.min.js">
</script>
<script>
var options = {
accept: "@Model.FileTypes",
maxFiles: "@Model.NumberOfFilesAllowed",
maxSize:"@Model.MaximumSizeAllowed",
onUploadDone: showFileData
}
const client = filestack.init('@Model.ApiKey');
client.picker(options).open();//Should only be
called when use clicks the button
// Call back function
function showFileData (result) {
const file = result.filesUploaded[0];
..................
}
</script>
And here is the angularjs
angularApp.controller('fileController', ["$scope", "$http", function ($scope, $http) {
$http.script = "//static.filestackapi.com/filestack-js/1.x.x/filestack.min.js";
const client = $scope.filestack.init("Api");
}]);
Can I send optional variables from cshtml by creating a javaobject and sending it to angularjs.
Any advice will be appreciated