Obtaining data from a custom widget


Hi, in my main form i have an variable name "isValid" ($data.isValid) and i need to take the value from a Custom Widget, the widget is this:

`<!-- The custom widget template is defined here
   - You can use standard HTML tags and AngularJS built-in directives, scope and interpolation system
   - Custom widget properties defined on the right can be used as variables in a templates with properties.newProperty
   - Functions exposed in the controller can be used with ctrl.newFunction()

<div name="datos" ng-click="ctrl.verificarRiF()">
<input type="hidden" id="esvalido" value="false">
 Click para verificar RIF
 <i id="nombre"></i>
 <i id="ARI"></i>
 <i id="CI"></i>
 <i id="Tasa"></i>

* The controller is a JavaScript function that augments the AngularJS scope and exposes functions that can be used in the custom widget template
* Custom widget properties defined on the right can be used as variables in a controller with $scope.properties
* To use AngularJS standard services, you must declare them in the main function arguments.
* You can leave the controller empty if you do not need it.
function ($scope) {
this.verificarRiF = function() {
var rif = $scope.properties.value;
type: "GET",
url: "http://cors.io/?u=http://contribuyente.seniat.gob.ve/getContribuyente/getrif?rif="+rif,
dataType: "xml",
//En caso de que el rif no se encuentre da una alerta
error: function() {
$data.isValid = 'false';
$scope.esvalido = 'false';
//En caso de que lo encuentre lo divide en sus campos correspondientes y le da un console.log();
success: function(xml){
$(xml).find('Rif').each(function() {
var Nombre = $(this).find('Nombre').text();
var AgenteRetencionIVA = $(this).find('AgenteRetencionIVA').text();
var ContribuyenteIVA = $(this).find('ContribuyenteIVA').text();
var Tasa = $(this).find('Tasa').text();
$( "#nombre" ).append(Nombre);
$( "#ARI" ).append(AgenteRetencionIVA);
$( "#CI" ).append(ContribuyenteIVA);
$( "#Tasa" ).append(Tasa);
$data.isValid = 'true';
$scope.esvalido = 'true';

Now, i need to give $data.isValid the propper response from the Ajax call. Either True or False but the problem is that i can't just use $data.isValid = true since it doesnt work, i can't use $scope.esvalido = 'true'; because i don't know how to access it from the UI designer since $data.esvalido doesnt work either.

(The AJAX call is ok, the problem is handling the response so i can access it from the UI Designer.)

No answers yet.