Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error: document.getElementById(...) is null
- handleDynamicEditingOfScriptsAndHtml@http://localhost/angularAdmin/js/controllers/userForm.js:190:34
- @http://localhost/angularAdmin/js/controllers/userForm.js:189:1
- invoke@http://localhost/angularAdmin/vendor/angular/angular.js:4118:14
- $ControllerProvider/this.$get</</<@http://localhost/angularAdmin/vendor/angular/angular.js:8356:11
- nodeLinkFn/<@http://localhost/angularAdmin/vendor/angular/angular.js:7608:13
- forEach@http://localhost/angularAdmin/vendor/angular/angular.js:347:11
- nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7607:11
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6996:13
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6996:13
- publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
- $ViewDirectiveFill/<.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3866:9
- invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
- nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
- publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
- updateView@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3800:23
- $ViewDirective/directive.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3768:9
- invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
- nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
- publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
- $ViewDirectiveFill/<.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3866:9invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
- publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
- updateView@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3800:23
- $ViewDirective/directive.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3768:9
- invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
- nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6996:13
- publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
- $ViewDirectiveFill/<.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3866:9
- invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
- nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
- compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
- publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
- updateView@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3800:23
- $ViewDirective/directive.compile/</<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3762:11
- $RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost/angularAdmin/vendor/angular/angular.js:14518:15
- transitionTo/$state.transition<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3169:11
- processQueue@http://localhost/angularAdmin/vendor/angular/angular.js:12984:27
- scheduleProcessQueue/<@http://localhost/angularAdmin/vendor/angular/angular.js:13000:27
- $RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost/angularAdmin/vendor/angular/angular.js:14200:16
- $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost/angularAdmin/vendor/angular/angular.js:14016:15
- $RootScopeProvider/this.$get</Scope.prototype.$evalAsync/<@http://localhost/angularAdmin/vendor/angular/angular.js:14238:15
- completeOutstandingRequest@http://localhost/angularAdmin/vendor/angular/angular.js:4842:7
- Browser/self.defer/timeoutId<@http://localhost/angularAdmin/vendor/angular/angular.js:5215:7
- <div ui-view="" class="fade-in ng-scope">
- [1]: https://angular-file-upload.appspot.com/
- 'use strict';
- angular.module('app', [
- 'ngFileUpload',
- 'toaster',
- 'LocalStorageModule',
- 'ngAnimate',
- 'ngCookies',
- 'ngResource',
- 'ngSanitize',
- 'ngTouch',
- 'ngStorage',
- 'ui.router',
- 'ui.bootstrap',
- 'ui.load',
- 'ui.jq',
- 'ui.validate',
- 'oc.lazyLoad',
- 'pascalprecht.translate'
- ]);
- 'use strict';
- /* Controllers */
- var version = '3.0.6';
- // Form controller
- app.controller('FormProfileCtrl', ['$scope', '$http', '$timeout', '$compile', '$upload', function ($scope, $http, $timeout, $compile, $upload) {
- $scope.usingFlash = FileAPI && FileAPI.upload != null;
- $scope.fileReaderSupported = window.FileReader != null && (window.FileAPI == null || FileAPI.html5 != false);
- $scope.changeAngularVersion = function () {
- window.location.hash = $scope.angularVersion;
- window.location.reload(true);
- };
- $scope.angularVersion = window.location.hash.length > 1 ? (window.location.hash.indexOf('/') === 1 ?
- window.location.hash.substring(2) : window.location.hash.substring(1)) : '1.2.20';
- $scope.$watch('files', function (files) {
- console.log(files);
- $scope.formUpload = false;
- if (files != null) {
- for (var i = 0; i < files.length; i++) {
- $scope.errorMsg = null;
- (function (file) {
- generateThumbAndUpload(file);
- })(files[i]);
- }
- }
- });
- $scope.uploadPic = function (files) {
- $scope.formUpload = true;
- if (files != null) {
- generateThumbAndUpload(files[0])
- }
- }
- function generateThumbAndUpload(file) {
- $scope.errorMsg = null;
- $scope.generateThumb(file);
- if ($scope.howToSend == 1) {
- uploadUsing$upload(file);
- } else if ($scope.howToSend == 2) {
- uploadUsing$http(file);
- } else {
- uploadS3(file);
- }
- }
- $scope.generateThumb = function (file) {
- if (file != null) {
- if ($scope.fileReaderSupported && file.type.indexOf('image') > -1) {
- $timeout(function () {
- var fileReader = new FileReader();
- fileReader.readAsDataURL(file);
- fileReader.onload = function (e) {
- $timeout(function () {
- file.dataUrl = e.target.result;
- });
- }
- });
- }
- }
- }
- function uploadUsing$upload(file) {
- file.upload = $upload.upload({
- url: 'https://angular-file-upload-cors-srv.appspot.com/upload' + $scope.getReqParams(),
- method: 'POST',
- headers: {
- 'my-header': 'my-header-value'
- },
- fields: {username: $scope.username},
- file: file,
- fileFormDataName: 'myFile',
- });
- file.upload.then(function (response) {
- $timeout(function () {
- file.result = response.data;
- });
- }, function (response) {
- if (response.status > 0)
- $scope.errorMsg = response.status + ': ' + response.data;
- });
- file.upload.progress(function (evt) {
- // Math.min is to fix IE which reports 200% sometimes
- file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
- });
- file.upload.xhr(function (xhr) {
- // xhr.upload.addEventListener('abort', function(){console.log('abort complete')}, false);
- });
- }
- function uploadUsing$http(file) {
- var fileReader = new FileReader();
- fileReader.onload = function (e) {
- $timeout(function () {
- file.upload = $upload.http({
- url: 'https://angular-file-upload-cors-srv.appspot.com/upload' + $scope.getReqParams(),
- method: 'POST',
- headers: {
- 'Content-Type': file.type
- },
- data: e.target.result
- });
- file.upload.then(function (response) {
- file.result = response.data;
- }, function (response) {
- if (response.status > 0)
- $scope.errorMsg = response.status + ': ' + response.data;
- });
- file.upload.progress(function (evt) {
- file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
- });
- }, 5000);
- }
- fileReader.readAsArrayBuffer(file);
- }
- function uploadS3(file) {
- file.upload = $upload
- .upload({
- url: $scope.s3url,
- method: 'POST',
- fields: {
- key: file.name,
- AWSAccessKeyId: $scope.AWSAccessKeyId,
- acl: $scope.acl,
- policy: $scope.policy,
- signature: $scope.signature,
- "Content-Type": file.type === null || file.type === '' ? 'application/octet-stream' : file.type,
- filename: file.name
- },
- file: file,
- });
- file.upload.then(function (response) {
- $timeout(function () {
- file.result = response.data;
- });
- }, function (response) {
- if (response.status > 0)
- $scope.errorMsg = response.status + ': ' + response.data;
- });
- file.upload.progress(function (evt) {
- file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
- });
- storeS3UploadConfigInLocalStore();
- }
- $scope.generateSignature = function () {
- $http.post('/s3sign?aws-secret-key=' + encodeURIComponent($scope.AWSSecretKey), $scope.jsonPolicy).
- success(function (data) {
- $scope.policy = data.policy;
- $scope.signature = data.signature;
- });
- }
- if (localStorage) {
- $scope.s3url = localStorage.getItem("s3url");
- $scope.AWSAccessKeyId = localStorage.getItem("AWSAccessKeyId");
- $scope.acl = localStorage.getItem("acl");
- $scope.success_action_redirect = localStorage.getItem("success_action_redirect");
- $scope.policy = localStorage.getItem("policy");
- $scope.signature = localStorage.getItem("signature");
- }
- $scope.success_action_redirect = $scope.success_action_redirect || window.location.protocol + "//" + window.location.host;
- $scope.jsonPolicy = $scope.jsonPolicy || '{n "expiration": "2020-01-01T00:00:00Z",n "conditions": [n {"bucket": "angular-file-upload"},n ["starts-with", "$key", ""],n {"acl": "private"},n ["starts-with", "$Content-Type", ""],n ["starts-with", "$filename", ""],n ["content-length-range", 0, 524288000]n ]n}';
- $scope.acl = $scope.acl || 'private';
- function storeS3UploadConfigInLocalStore() {
- if ($scope.howToSend == 3 && localStorage) {
- localStorage.setItem("s3url", $scope.s3url);
- localStorage.setItem("AWSAccessKeyId", $scope.AWSAccessKeyId);
- localStorage.setItem("acl", $scope.acl);
- localStorage.setItem("success_action_redirect", $scope.success_action_redirect);
- localStorage.setItem("policy", $scope.policy);
- localStorage.setItem("signature", $scope.signature);
- }
- }
- (function handleDynamicEditingOfScriptsAndHtml($scope, $http) {
- $scope.defaultHtml = document.getElementById('editArea').innerHTML.replace(/tttt/g, '');
- $scope.editHtml = (localStorage && localStorage.getItem("editHtml" + version)) || $scope.defaultHtml;
- function htmlEdit(update) {
- document.getElementById("editArea").innerHTML = $scope.editHtml;
- $compile(document.getElementById("editArea"))($scope);
- $scope.editHtml && localStorage && localStorage.setItem("editHtml" + version, $scope.editHtml);
- if ($scope.editHtml != $scope.htmlEditor.getValue())
- $scope.htmlEditor.setValue($scope.editHtml);
- }
- $scope.$watch("editHtml", htmlEdit);
- $scope.htmlEditor = CodeMirror(document.getElementById('htmlEdit'), {
- lineNumbers: true, indentUnit: 4,
- mode: "htmlmixed"
- });
- $scope.htmlEditor.on('change', function () {
- if ($scope.editHtml != $scope.htmlEditor.getValue()) {
- $scope.editHtml = $scope.htmlEditor.getValue();
- htmlEdit();
- }
- });
- })($scope, $http);
- $scope.confirm = function () {
- return confirm('Are you sure? Your local changes will be lost.');
- }
- $scope.getReqParams = function () {
- return $scope.generateErrorOnServer ? "?errorCode=" + $scope.serverErrorCode +
- "&errorMessage=" + $scope.serverErrorMsg : "";
- }
- angular.element(window).bind("dragover", function (e) {
- e.preventDefault();
- });
- angular.element(window).bind("drop", function (e) {
- e.preventDefault();
- });
- }])
- ;
- <div class="bg-light lter b-b wrapper-md">
- <h1 class="m-n font-thin h3">Edit User</h1>
- </div>
- <div class="wrapper-md">
- <!-- breadcrumb -->
- <div>
- <ul class="breadcrumb bg-white b-a">
- <li><a ui-sref="app.dashboard"><i class="fa fa-home"></i> Dashboard</a></li>
- <li class="active">Edit User</li>
- </ul>
- </div>
- <!-- / breadcrumb -->
- <div class="col-lg-12">
- <div class="wrapper-md" ng-controller="FormProfileCtrl">
- <form name="userForm" class="form-validation">
- <tabset justified="true" class="tab-container">
- <tab heading="Personal Information">
- <div class="panel-body">
- <div class="form-group">
- <label>Username</label>
- <input type="text" class="form-control" ng-model="user.vName" >
- </div>
- <div class="form-group">
- <label>Email</label>
- <input type="email" class="form-control" ng-model="user.vEmail">
- </div>
- <div class="form-group">
- <label>Phone</label>
- <input type="text" class="form-control" ng-model="user.vPhone" >
- </div>
- <div class="form-group">
- <label>Address</label>
- <textarea class="form-control" ng-model="user.vAddress" ></textarea>
- </div>
- <div class="form-group pull-in clearfix">
- <div class="col-sm-6">
- <label>Enter password</label>
- <input type="password" class="form-control" name="vPassword" ng-model="vPassword" >
- </div>
- <div class="col-sm-6">
- <label>Confirm password</label>
- <input type="password" class="form-control" name="confirm_password" required ng-model="confirm_password" ui-validate=" '$value==password' " ui-validate-watch=" 'password' ">
- <span ng-show='form.confirm_password.$error.validator'>Passwords do not match!</span>
- </div>
- </div>
- </div>
- </tab>
- <tab heading="Company Information">
- <div class="form-group">
- <label>Company Name</label>
- <input type="text" class="form-control" ng-model="user.vCompanyName" >
- </div>
- <div class="form-group">
- <label>Phone</label>
- <input type="text" class="form-control" ng-model="user.vCompanyPhone" >
- </div>
- <div class="form-group">
- <label>Designation</label>
- <input type="text" class="form-control" ng-model="user.vDesignation" >
- </div>
- <div class="form-group">
- <label>Address</label>
- <textarea class="form-control" ng-model="user.vCompanyAddress" ></textarea>
- </div>
- </tab>
- </tabset>
- <!-- I want -->
- <div class="upload-div">
- <div class="upload-buttons">
- <div id="editArea">
- <fieldset><legend>Upload right away</legend>
- <div ng-file-drop ng-file-select ng-model="files" ng-model-rejected="rejFiles"
- drag-over-class="{accept:'dragover', reject:'dragover-err', delay:100}" class="drop-box"
- ng-multiple="true" allow-dir="true" ng-accept="'image/*,application/pdf'">
- Drop Images or PDFs<div>or click to select</div>
- </div>
- <div ng-no-file-drop class="drop-box">File Farg&Drop not supported on your browser</div>
- </fieldset>
- <br/>
- </div>
- </div>
- <ul ng-show="rejFiles.length > 0" class="response">
- <li class="sel-file" ng-repeat="f in rejFiles">
- Rejected file: {{f.name}} - size: {{f.size}}B - type: {{f.type}}
- </li>
- </ul>
- <ul ng-show="files.length > 0" class="response">
- <li class="sel-file" ng-repeat="f in files">
- <img ng-show="f.dataUrl" ng-src="{{f.dataUrl}}" class="thumb">
- <span class="progress" ng-show="f.progress >= 0">
- <div style="width:{{f.progress}}%">{{f.progress}}%</div>
- </span>
- <button class="button" ng-click="f.upload.abort();
- f.upload.aborted = true"
- ng-show="f.upload != null && f.progress < 100 && !f.upload.aborted">Abort</button>
- {{f.name}} - size: {{f.size}}B - type: {{f.type}}
- <a ng-show="f.result" href="javascript:void(0)" ng-click="f.showDetail = !f.showDetail">details</a>
- <div ng-show="f.showDetail">
- <br/>
- <div data-ng-show="f.result.result == null">{{f.result}}</div>
- <ul>
- <li ng-repeat="item in f.result.result">
- <div data-ng-show="item.name">file name: {{item.name}}</div>
- <div data-ng-show="item.fieldName">name: {{item.fieldName}}</div>
- <div data-ng-show="item.size">size on the serve: {{item.size}}</div>
- <div data-ng-show="item.value">value: {{item.value}}</div>
- </li>
- </ul>
- <div data-ng-show="f.result.requestHeaders" class="reqh">request headers: {{f.result.requestHeaders}}</div>
- </div>
- </li>
- </ul>
- <br/>
- <div class="err" ng-show="errorMsg != null">{{errorMsg}}</div>
- </div>
- <input type="hidden" class="form-control" ng-model="user.iUserID">
- <input type="submit" class="btn btn-success" ng-click="postForm(user)">
- </form>
- </div>
- </div>
- $scope.tab_data = {}
- $scope.$watch 'tab_data.files', ->
- $scope.upload $scope.tab_data.files
- <div ngf-drop ngf-select ng-model="tab_data.files" class="drop-box" ngf-drag-over-class="dragover" ngf-multiple="true" ngf-allow-dir="true" ngf-accept="'.jpg,.png,.pdf'" class="drop-box">
- <div ngf-drop-available >Drop Images here</div>
- <div ngf-no-file-drop>File Drag/Drop is not supported for this browser</div>
- <div>click to select</div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement