2
I have a button that opens a modal, where words will be typed separated by commas that will become the radio button options on the main page. When saving the modal you must insert an HTML template with this embedded data.
Follows plunker
2
I have a button that opens a modal, where words will be typed separated by commas that will become the radio button options on the main page. When saving the modal you must insert an HTML template with this embedded data.
Follows plunker
2
This Plunker contains the following corrections for the operation of its modal:
The ui.bootstrap script files were imported;
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.2.0/ui-bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.2.0/ui-bootstrap-tpls.min.js" type="text/javascript"></script>
Added library import to module
:
var app = angular.module('plunker', ['ui.bootstrap']);
Added service
for the passage of variables:
angular
.module('plunker')
.factory('serviceModal', serviceModal);
serviceModal.$inject = [];
function serviceModal() {
var opcoes = "";
return {
setOpcoes: setOpcoes,
getOpcoes: getOpcoes
}
function setOpcoes(novasOpcoes) {
this.opcoes = novasOpcoes;
}
function getOpcoes() {
if (this.opcoes === undefined) {
this.opcoes = "";
}
return this.opcoes;
}
}
Added dependency injections in controller
main to $uibModal
, $timeout
and serviceModal
:
.controller('MainCtrl', function($scope, $uibModal, $timeout, serviceModal)
Use of service
for the passage of variables:
serviceModal.setOpcoes($scope.data.opcoes);
and
$scope.verificarOpcoes = function() {
var op = serviceModal.getOpcoes();
if (op !== undefined && op !== "") {
return op.split(",");
}
}
the modal issue I had already solved, the plunker which you opened probably is not updated. Ps. in the plunker you must restore the session to see the updated version. What I need is to insert the template through the modal.
That plunker you’re sending doesn’t work, it just shows an alert. You saved it?
I saved, on the left side of the plunker, you restore the session (Restore)
I’ll change mine here and send it again
Changed, please check if the idea is this
The system will mount Formularies, so I have a menu with several options like textbox, dropdowlist, radiobutton. Then there will be several blocks with these fields. The modal is to already insert the information in these controls, so I can not leave in the index already the radio input, in this case I will have to use an external file as _checkradio.html where the structure of each element comes from.
It won’t make a difference. You’ll be using a service to pass on the information. This example is to give you an idea of how you pass information between controllers. The essence is the same, you will only have other controllers using the same service and do basically the same thing that is being done in index.html.
Browser other questions tagged javascript angularjs
You are not signed in. Login or sign up in order to post.
Missed import for angular-ui.bootstrap, no?
– Sorack