Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Ken
@thekennysong
                        key: 'quantity',
                        type: 'input',
                        templateOptions: {
                            label: 'Quantity',
                            type: 'text'
                        },
                        hideExpression: 'model.primary_packaging !== "tray"'
                    }
it works with 1
Kent C. Dodds
@kentcdodds
Make sure that the logic is doing what you think it's doing.
'model.primary_packaging !== "tray" || model.primary_packaging !== "shelf_carton"' means that the field will hide if the primary_packaging is not equal to tray or shelf_carton
If that's what you're trying to do, then could you make an example: http://new-example.angular-formly.com
Kent C. Dodds
@kentcdodds
@/all I will only accept a PR for this one if you haven't ever contributed to open source before :-) https://github.com/formly-js/angular-formly/issues/343#issuecomment-111495740
I'm willing to hold your hand through it.
Caleb Kniffen
@ckniffen
Nice
Kent C. Dodds
@kentcdodds
Though, I'll probably only wait a few days, because I'd like to get this feature in :-)
matthew harwood
@matthewharwood
@kentcdodds hey man have you tried to run any unit tests with angular 2?
Kent C. Dodds
@kentcdodds
nope, not yet @matthewharwood
matthew harwood
@matthewharwood
Dang thanks :)
Kent C. Dodds
@kentcdodds
I would recommend you ask the people in the https://gitter.im/angular/angular room
Kent C. Dodds
@kentcdodds
Hey, if anyone has some time, I'm trying out some features of codecov.io. If someone could write a test for formly-focus and submit a PR that'd be great. I want to see the codecov status / comment features on the PR. Or if you don't want to setup a whole new test file, you could create a test for formlyConfig.extras.disableNgModelAttrsManipulator in formlyNgModelAttrsManipulator. Anyway, I'd really appreciate it!
Abdullah Mohammed
@abodacs
@benoror great work @panax i have a question how do you store form configuration at backend ?
Ben Orozco
@benoror
Hi @abodacs sorry for the delay, I will pm you
Or we can chat in panaxit/panaxit channel
websta
@websta
Hi All! I'm using formly to display data retrieved via $http from Java backend containing an unix timestamp (milliseconds). I wrote a method, which translated the timestamp with moment.js into a JS Date object, added an additional field (for display purposes) on the object and provided it to formly. On submit, another method updates the unix timestamp from the formly input and transmittes the data back to the backend. But the backend does not accept an additional field. So, I tried to implement this kind of translations with formly-fieldconfig-controller and templateOptions.onBlur. The controller triggers on load and updates the model value perfectly, but the onBlur event has only access to field and scope without the model. So submitting the formly input only contains the JS Date Object. Could you give me any suggestions please?
```
'templateOptions': {
'onBlur': function(field, $scope) {
var newValue = (function dateConversion(oldValue) { return parseInt(moment(oldValue).format('x'), 10); })($scope.value);
// Change in model
$scope.value = newValue;
$scope.formControl.$modelValue = newValue;
}
},
controller: function ($scope) { // code from formly gitter chat
var newValue = (function dateConversion(oldValue) {
return moment(oldValue).toDate();
})($scope.model[$scope.options.key]);
// Change in model
$scope.model[$scope.options.key] = newValue;
// Change original value as well (keep in $pristine)
$scope.options.value = newValue;
}
´´´
Kent C. Dodds
@kentcdodds
If you want to have a field for view purposes only, set it's model to formControl
so: model: 'formControl'
Caleb Kniffen
@ckniffen
@websta The way I got around a similar situation was to create a new field type that did that instead of externally updating it
Kent C. Dodds
@kentcdodds
another thing you may consider is using parsers and formatters...
Thinking about implementing an api for those in formly... Report an issue if you're interested :-)
Kent C. Dodds
@kentcdodds
If anyone's looking for a good time, there's a question on Stack Overflow about angular-formly :-) http://stackoverflow.com/q/30849301/971592
websta
@websta
@kentcdodds @ckniffen Thank you for your fast answers, I will go for a new field type.
Caleb Kniffen
@ckniffen
@websta in my particular case I have to use a special date format so it was the best option for me. I define a controller for the custom type and use modelOptions getterSetter.
Caleb Kniffen
@ckniffen
Not directly related to formly but any recommendations on taggable input directives that aren’t ui-select?
Kent C. Dodds
@kentcdodds
Unfortunately no. I was planning on just writing my own :-(
Caleb Kniffen
@ckniffen
Yeah I am a fan of the library but I am encountering a lot of bugs some of which there are open PRs out for … Most of them involve using the tagging features
@kentcdodds let me know when you do I would love to contribute.
Kent C. Dodds
@kentcdodds
:+1:
I built a really really cool one at a previous job.
I'm sure they would have let me open source it if I had thought about it at the time
Ben Orozco
@benoror
@ckniffen ui-select needs some love definitely
Jonathan Haines
@BarryThePenguin
Can someone please tell me if I'm taking this too far?...
Bootstrap input-group, an input field and a submit button
Is it worth trying to use formly for a single field and button?
I'll do a quick jsbin
Caleb Kniffen
@ckniffen
If that's all you have in your app then no. But if you are using it elsewhere in your app I see no problem.
Jonathan Haines
@BarryThePenguin
Yeah, we're using it everywhere
Michael Robinson
@faceleg
I used formly for a quick POC yesterday, converting a big JSON into a form
Team was blown away, thanks for the hard work team
Jonathan Haines
@BarryThePenguin
This is an example http://jsbin.com/mugevixugu/
input-group requires a specific html structure that I'm not sure can be achieved with formly
should I just give up and make it a regular form as it is so simple?
Ben Orozco
@benoror
Jonathan Haines
@BarryThePenguin
Just going down that path now
I think my main problem is the formly-field directive separating the submit button and the input field
Kent C. Dodds
@kentcdodds
@BarryThePenguin, are all of your forms the same input-group, input field, and submit button?
Or are they all different slightly?