-
-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
two way binding #717
Comments
That is a "feature" of angular-xeditable. That is how it was designed. |
when i am adding more fields then two way binding is not working.
i am printing the arrrayObject(
console.log("2wayBinding",$scope.activeModules['settings/customer-profile/get-customer-details'].profileData.contact)
) after clicking the add more field.
Please go through the code
code:
HTML Code-->
<form editable-form name="editableForm" onaftersave="updateCompanyName()">
<span class="glyphicon glyphicon-pencil pull-right" ng-click="editableForm.$show();" ng-show="!editableForm.$visible"> </span>
<ul ng-repeat="contacts in activeModules['settings/customer-profile/get-customer-details'].profileData.contact track by $index" class="contact-details-align">
<li> <span editable-text="contacts.title" e-label="Title" onbeforesave="checkContactDetail($data)" e-name="title{{$index}}"> <b>{{contacts.title}}</b> </span> <br> <span editable-text="contacts.name" e-label="Name" onbeforesave="checkContactDetail($data)" e-name="name{{$index}}"> {{contacts.name}} </span> <br> <span editable-email="contacts.email" e-label="Email" onbeforesave="checkContactDetail($data)" e-name="email{{$index}}"> {{contacts.email}} </span> <br> <span e-pattern="^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$" e-title="Number only" editable-text="contacts.number" e-label="Contact no." onbeforesave="checkContactDetail($data)" e-name="number{{$index}}"> {{contacts.number}} </span> <br> </li>
<input ng-show="editableForm.$visible" type="button" ng-click="removeNewChoice($index)" value="Remove" class="btn btn-global-full" ng-show="editableForm.$visible" style="float: right; margin: 10px 0px 10px 0px" ng-disabled="activeModules['settings/customer-profile/get-customer-details'].profileData.contact.length == 1">
</ul>
<!-- buttons to submit / cancel form -->
<span ng-show="editableForm.$visible"> <div style="margin-bottom: 10px;"><input type="button" ng-click="addNewChoice()" value="Add More Contacts" class="btn btn-global-full" style="margin-left: 17px;"></div>
<button type="button" class="btn btn-global-outline btn-customer-remove" ng-disabled="editableForm.$waiting" ng-click="editableForm.$cancel()"> <span class="glyphicon glyphicon-remove"></span> </button> <button type="submit" class="btn btn-global-full pull-right" ng-disabled="editableForm.$waiting"> <span class="glyphicon glyphicon-ok"></span> </button> </span>
</form>
JS Code-->
$scope.addNewChoice = function() {
$scope.activeModules['settings/customer-profile/get-customer-details'].profileData.contact.push({});
console.log("2wayBinding",$scope.activeModules['settings/customer-profile/get-customer-details'].profileData.contact)
};
$scope.removeNewChoice = function(index) {
if(index >= 0 && $scope.activeModules['settings/customer-profile/get-customer-details'].profileData.contact.length>1){
$scope.activeModules['settings/customer-profile/get-customer-details'].profileData.contact.splice(index, 1);
console.log("index",index)
}
}
…________________________________
From: ckosloski <[email protected]>
Sent: Tuesday, January 30, 2018 3:53:07 PM
To: vitalets/angular-xeditable
Cc: Ketan Jain; Author
Subject: Re: [vitalets/angular-xeditable] two way binding (#717)
That is a "feature" of angular-xeditable. That is how it was designed.
What problem are you trying to solve that would require two-way binding?
I will be happy to review any PR's submitted.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#717 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AiSVvRT7zF9GWKOJTozchXsLBdLInaYpks5tP6tjgaJpZM4Rx50H>.
|
Can you add a plnkr or jsfiddle showing your issue? One observation, I think you need to actually add an object on the push, something like:
|
when i type into input box then it should get bind like it does in ng-model angularjs which is called two binding but in editable-text case it didn't get binded.
https://www.w3schools.com/angular/tryit.asp?filename=try_ng_model_two-way ----->want this feature in editable-text="" <https://www.w3schools.com/angular/tryit.asp?filename=try_ng_model_two-way>
Tryit Editor v3.5 - W3Schools<https://www.w3schools.com/angular/tryit.asp?filename=try_ng_model_two-way>
www.w3schools.com
Save to Google Drive. If you have a Google account, you can save this code to your Google Drive. Google will ask you to confirm Google Drive access.
…________________________________
From: ckosloski <[email protected]>
Sent: Wednesday, January 31, 2018 5:50:31 AM
To: vitalets/angular-xeditable
Cc: Ketan Jain; Author
Subject: Re: [vitalets/angular-xeditable] two way binding (#717)
Can you add a plnkr or jsfiddle showing your issue?
I don't quite understand what your issue is.
On add, you are logging something and the logging isn't working?
Or is the display of the new row not happening on add?
One observation, I think you need to actually add an object on the push, something like:
$scope.addNewChoice = function() {
$scope.inserted = {
name: '',
email: '',
number: ''
};
$scope.activeModules['settings/customer-profile/get-customer-details'].profileData.contact.push(inserted);
};
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#717 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AiSVvQwfg3qYFCm2d4Nh45naX0asvfvxks5tQG-ngaJpZM4Rx50H>.
|
I'm sorry, but angular-xeditable is not setup that way. |
Hi,
Please find the attached screenshot and help us out in implementing this functionality where i want to create a dynamic form on clicking add button and remove the same.
Thanks & Regards
Ketan Jain
…________________________________
From: ckosloski <[email protected]>
Sent: Thursday, February 1, 2018 6:36:28 AM
To: vitalets/angular-xeditable
Cc: Ketan Jain; Author
Subject: Re: [vitalets/angular-xeditable] two way binding (#717)
I'm sorry, but angular-xeditable is not setup that way.
I can try and help you find a solution to your specific problem if you describe it more or provide a plunkr/jsfiddle.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#717 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AiSVvcYRbcSK2EPK8zpWw9nVw6G0djcEks5tQcvsgaJpZM4Rx50H>.
|
There is no image attached. |
two binding is not supporting in editable-text="", value is binding only after clicking submit button but it should be two way binded as it happen in angularjs.
The text was updated successfully, but these errors were encountered: