angular store and retrieve more inline data - angularjs

I was working on a simple angular functionality. but got stuck.
e.g.
<input type="radio" data-ng-model="package" value="1" data-more="some text here" />
Is there a way to retrieve the more data?
I know I can get the value by this using this: {{package}}
Cheers

Related

How to remove scientific notation for <input type="number" step="0.00000001">, React JS?

I am using ant design form in my reactJS application and I'd like to remove the scientific notation from my Input component?
Attaching the sample code
<Input type="number" step="0.00000001" />
Output
This is kind of a dumb solution, but it works: just read the value out of the field and write it back in again in the format you want.
<input type="number" step="0.00000001" onchange="this.value=parseFloat(this.value).toFixed(8);" />

ColdFusion handling of datatables "sent parameters"

Anyone have experience with using jQuery datatables with ColdFusion? Did you have any success in using the "serverSide" mode, in getting CF to properly parse the parameters sent by datatables to the server into complex variables? For example, currently if I dump the "form" I'm getting keys like columns[1][data] or search[value]. How do I get ColdFusion to parse these parameters into variables like form.columns[1].data or form.search.value?
According to the documentation at https://datatables.net/manual/server-side, it says:
In most modern server-side scripting environments this data will automatically be available to you as an array.
I'm using ColdFusion 11.
You might want to check out a utility called FormUtils.
It can take this
<h2 class="is-size-2">employee[1]</h2>
<input name="employee[1].name" type="text" value=""><br />
<input name="employee[1].phone" type="text" value=""><br />
<input name="employee[1].permission.2" type="text" value=""><br />
<input name="employee[1].permission.1" type="text" value=""><br />
<input name="employee[1].mode[2]" type="text" value=""><br />
<input name="employee[1].mode[1]" type="text" value=""><br />
And turn it into structs and arrays
<cfset util = new formutils.FormUtils().init() />
<!--- form has been patched --->
<cfdump var="#form#">
It basically allows forms to be pushed over as structs and arrays
Disclaimer
I rewrote the original. The original was done by Brian Kotek.
The links below are to my version of the code. There are also links to his version.
Video demo of it in action: https://coldfusion.adobe.com/2018/10/make-form-processing-simpler-with-brian-koteks-formutils/
Core file: https://github.com/jmohler1970/FormUtils
Demo site: https://github.com/jmohler1970/FormUtils_demo

AngularJS: Are there multiple ways to apply ng-model to a form?

I'm using Scala-Play with the Play-Bootstrap extension and AngularJS. Since the controlling of the application is managed by AngularJS I need the form to be submitted and the response managed by AngularJS and not by the Play controller.
As I understand and using pure AngularJS one can use ng-model to link each input to a specific $scope nested variable e.g.
<form name="userForm">
<label>
Name:
<input type="text" name="userName"
ng-model="user.name"/>
</label><br />
<label>
Other data:
<input type="text" ng-model="user.data" />
</label><br />
</form>
is it possible to accomplish the same by using ng-model on the form tag? instead of applying it to each input? the problem is that it is not possible injecting the needed ng-model to each input while using Play-Bootstrap i.e. this doesn't work:
#b3.text(computeInSampleForm("impliedVolSpread"), '_label -> messagesApi("myapp.impliedVolSpread"),
'_showConstraints -> false, 'ng-model -> "impliedVolSpread")
it fails with error value - is not a member of Symbol it would work if I only knew how to escape the - dash character.
Since I already created a customized version of the b3.form as b3.bgform it would be great if I could do bg-model at the form level ... is that possible?
You can fix this error by explicitly converting to a Symbol:
Symbol("ng-model") -> "impliedVolSpread"
Or by using an implicit conversion import:
#import views.html.helper.Implicits._

Uploading file with form input

i've been going from page to page all over the internet trying to find a simple and recommended way of uploading a single file in angularjs, so far i have found none, what i want is to be able to do something like this:
<input type="file" ng-model="file" id="form.file" />
<input type="text" ng-model="name" id="form.name" />
Then in my controller/service i have a function that posts all my form data:
SomeRandomService.save = function($scope.form) {
return $http
.post('/api/v1/some/random/url/', $scope.form)
};
Is this so difficult in angular? I am a newbie to angular so i can't even understand some of the solutions i have found online.
Is there something way more simpler? A plugin or service or directive that can do this for me?

How to auto populate text field in angular js based on other form fields

I'm giving an student scenario as example.
Assume I have the below scope variables that needs to populated when I select a id.
$scope.student.name;
$scope.student.address;
$scope.student.city;
$scope.student.zip;
The sample html below.
<input type="text" ng-model="student.id"/>
<input type="text" ng-model="student.name"/>
<input type="text" ng-model="student.city"/>
<input type="text" ng-model="student.address"/>
<input type="text" ng-model="student.zip">
In a regular jQuery, I would write on change and trigger. But how do I achieve this in angular way.
I might want to have the entire db values in a hashmap of <studentid,List<studentdetails>> and use this hashmap values to be populated on the respective fields.
I know this is probably a little late on the draw to answering this question, but I was searching for an answer to auto-population with Angular today and found that you could populate an input using ng-value and passing it into your value held inside of {{}}.
It would look something like this: ng-value="{{exampleValue}}
Hope this helps.

Resources