Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.directive('dataFactoryModal', ['$compile', '$timeout', function($compile, $timeout) {
- return {
- scope: { .... }
- link: function (scope, element, attrs) {
- var html = '
- <input ng-model = "recipients" name = "email" type = "text" placeholder = "Enter email(s)" >
- ....
- // Modal button section
- <button type = "button" class = "btn btn-primary" data-factory = "{{dataFactoryCodes}}" data-recipients = "">Submit</button>
- ....
- ';
- ....
- }
- }
- }
- <button type = "button" class = "btn btn-primary" data-factory = "123;109;129" data-recipients = "meme@email.com;yayaya@email.com">Submit</button>
- <button type = "button" class = "btn btn-primary" data-factory = "{{dataFactoryCodes}}" data-recipients = "{{recipients}}">Submit</button>
- scope.replaceCommas = function(value) {
- if (value!==undefined) {
- return value.replace(',', ';');
- }
- }
- data-list = {{replaceCommas(recipients)}}
- data-list = "email@email.com;email2@email.com,email3@email.com"
- scope.$watch('recipients', function(newValue, oldValue) {
- scope.email = newValue;
- // if I did this, this would replace all commas with semicolons on the button attribute AND on the textfield
- scope.email = newValue.replace(',', ';');
- // if I did this, this would just replace only the first comma
- scope.emailTags = newValue.replace(',', ';');
- }
- data-list = {{emailTags}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement