angularjs

【Java】【SpringBoot】基于BASE64的图片上传、存储

依然范特西╮ 提交于 2021-02-04 04:23:08
前台 上传控件: <input type="file" class="custom-file-input" id=" homeImg " name='homeImg'/> JS提交: // 保存图片信息 $scope.save = function () { var fd = new FormData(); var file = document.getElementById(' homeImg ').files[0 ]; fd.append( ' homeImg ' , file); $http.post(CommonConfig.RestBaseUrl.CaoBaoService + 'homeimgs/upload?id=' + $scope.detailInfo.id + '&sortNum=' + $scope.detailInfo.sortNum, fd, CommonConfig.fileUploadReqConfig) .then( function (result) { // 正确请求成功时处理 console.log('save:result' , result); if (result.data.code == 'NONE_ERROR' ) { $scope.modalContent = '保存成功!' ; $( '#myModal').modal('show

Bold part of String

拜拜、爱过 提交于 2021-02-03 06:40:08
问题 What is the best way to bold a part of string in Javascript? I have an array of objects. Each object has a name. There is also an input parameter. If, for example, you write "sa" in input, it automatically searches in array looking for objects with names that contain "sa" string. When I print all the names, I want to bold the part of the name that coincide with the input text. For example, if I search for "Ma": Ma ria A ma ria etc... I need a solution that doesn't use jQuery. Help is

ng2-ckeditor Add Placeholder plugin using typescript and angular 2.0

喜夏-厌秋 提交于 2021-02-02 09:01:58
问题 I am trying to get placeholder plugin in the CKEditor toolbar but getting following error when adding extraPlugins:'placeholder' to CKEditor config - Error: [CKEDITOR.resourceManager.load] Resource name "placeholder" was not found at "//cdn.ckeditor.com/4.5.9/standard/plugins/placeholder/plugin.js?t=G6DD". Here is console log screenshot - I have also created a plunker. I have installed "ng2-ckeditor": "^1.0.4" via npm. Can i get some help ? 回答1: you should use that: <script src="https://cdn

How to handle two set of library's in your front end project?

允我心安 提交于 2021-01-29 17:37:00
问题 I am having Angular 1.x/jQuery project where I have already loaded all front end library like jQuery.js, require.js,angular.js. Now I am planning to integrate with Madcap Documentation libraries. They are giving another set of same front-end jQuery/require js library which is a different version than the existing version of my project. How can I load the new madcap library without conflicting the existing UX library? We have a angular-summernote on our project which throws error like

Formatting momentjs date-time

这一生的挚爱 提交于 2021-01-29 16:57:19
问题 Hi everyone I have looked at a few SO questions but have yet to find a solid answer to my problem. Question I have already looked at include: Moment.js returning wrong date Moment JS - parse UTC and convert to Local and vice versa My question is the following: I have a basic time selector with times ranging from 4:00am - 8:00pm. I want to use the time selected along with a hard-coded date to format something that looks like this: "2015-05-03T04:00:00" Here's what I have so far: time = moment(

Formly update templateOptions on click of button

烈酒焚心 提交于 2021-01-29 14:39:49
问题 I'm new to formly, I want to change the templateOptions property based on value, so below is my config formlyConfig.setType({ name: 'phone', extends: 'maskedInput', defaultOptions: { templateOptions: { mask: '999-9999-9999' }, I want to change the mask to mask: '999-999-9999' on a button click, I tried to do this on onclick of button , but no change formlyConfig.setType({ name: 'phone', defaultOptions:{ templateOptions: { mask: '999-999-9999' }, } }) ; 回答1: I'm considering you're using

How to add Angular attributes to dynamically generated element with a function as the parameter?

孤街醉人 提交于 2021-01-29 14:24:43
问题 I am relatively new to JavaScript and AngularJS. I have been attempting to add an 'ng-click' attribute to a link element with a function as the parameter using the code below: var aTag1 = document.createElement('a'); aTag1.setAttribute('ng-click', "setID(" + response.data[i].resultID + ")"); JavaScript seems to acknowledge that the attribute has been added to the element but the function isn't run when the link is clicked. I'm sure there is a simple answer but I haven't been able to find one

fa fa-icons in ng-class with ternary operator (Angular.Js 1.x)?

蓝咒 提交于 2021-01-29 12:30:19
问题 May be my this SO not clear, so again trying to ask what i really want(forgive,if its still not clear). Trying to reduce multiple html snippets into single line. Actual blocks looks like below (having more than 8 columns like below) <div class="spanHolder"> <span ng-click="reOrderTbl('marchendId', asd)">data.columnName</span> <span ng-hide="presentHeader != previousHeader || presentHeader =='itemID'"><i class="fa fa-thumbs-up"></i></span> <span ng-show="alterTblType && presentHeader=='itemID'

Webpack plugins and/or strategies for AngularJS

谁说我不能喝 提交于 2021-01-29 11:00:08
问题 I have an AngularJS 1.7 project currently being built with Gulp, and I'm looking into switching it over to Webpack. After some initial poking around, I'm finding it difficult to find and load all the source files, due to the fact that it's written in a style from before CommonJS and ES6 modules. My hunch is that it's a common (but old) style of Angular, but I'm new to it so I'm not sure. The Question : Is there a Webpack plugin or tool or strategy for building Angular 1 projects? I'm hoping

Is there a way to update a document when date is expired in mongodb?

戏子无情 提交于 2021-01-29 10:47:33
问题 I have read some solutions and wonder if I can update (not delete) a document in mongodb if the date is expired after 2 days. Like this. date:2019-02-15 status:not expired After 2 days update the status into expired . Here is my code for posting a document. var bloodstock = new Bloodstock(); bloodstock.date = new Date(); bloodstock.status = "not expired"; bloodstock.save(function(err) {}); 回答1: Run a cron at daily midnight to compare the date. If the date exists 2 days update the status on