Requirement : selection of radio buttons should bring their respective input boxes. Below is the part of my html and controller. I am using ng-change to invoke the function written in controller. The function in controller just shows the div using jquery. fyi, My template is rendering and I don't see any error on console and functions in controller are getting invoked too.
Issue - On the click on radio button, respective div is is not rendering. Any hints are highly appreciated.
<div ng-app="app" ng-controller="FestCtrl">
<form name="addForm" class="form-horizontal" ng-submit="submitForm(fest)">
<!-- Options to user to either enter a new role OR select from an existing one's -->
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-primary">
<input type="radio" name="options" id="option1" autocomplete="off" ng-model="value" ng-change="newfest()"> New
</label>
<label class="btn btn-primary">
<input type="radio" name="options" id="option2" autocomplete="off" ng-model="value" ng-change="existingfest()"> Existing
</label>
</div>
<br>
<br>
<!-- Respective input will be presented depending on above selection-->
<div id="addNewDiv" class="form-group">
<label class="control-label" for="InputId">New</label>
<input required type="text" class="form-control" id="groupIdInput" placeholder="Insert new fest" ng-model="fest.role">
</div>
<div id="selectExistingDiv" class="form-group">
<label for="select1">Select</label>
<select ng-model="fest.role" class="form-control" id="select1" ng-options="val for val in festArray">
<option value="">Select</option>
</select>
</div>
</form>
</div>
var app = angular.module('App');
app.controller('FestCtrl', ['$scope', '$state', function($scope, $state) {
$(function() {
$("[data-hide]").on("click", function() {
$(this).closest("." + $(this).attr("data-hide")).hide();
});
});
$("#addNewDiv").hide();
$("#selectExistingDiv").hide();
$scope.newRole = function() {
$("#addNewDiv").show();
}
$scope.existingRole = function() {
$("#selectExistingDiv").show();
}
}]);