The situation that I have is:
I have a searchbox
to find colleges, and one of the options that are available in the results is I can't found my college
. This option let you enter the name of your college manually in other input type="text"
that only appear if you click on this option. When you click the option to enter the college manually the searchbox
became disable using and ng-disable
. The functionality that I need to implement is that when the user click on the disable searchbox
again this one can be able again, hide the other input text to insert the college manually and let him/her be able to search for college again. This is kind of representation of the situation code:
Template:
...
<div class="input-wrapper">
<input class="searchbox" ng-disabled="!searching" type="text" ng-model="collegeSearch" ng-click="searchingAgain()">
</div>
<br>
<ul class="result-wrapper" ng-show="searching && collegeSearch.length > 0">
<li>Result 1</li>
<li>Result 2</li>
<li ng-click="insertManually()">I can't found my college</li>
</ul>
<input ng-show="!searching" type="text" placeholder="Enter the college name manually">
...
Controller:
angular.module('tAngularApp')
.controller('MainCtrl', ["$scope", "$rootScope", function ($scope, $rootScope) {
this.awesomeThings = [
'HTML5 Boilerplate',
'AngularJS',
'Karma'
];
$scope.searching = true;
$scope.insertManually = function () {
$scope.searching = false;
$scope.collegeSearch = "";
}
$scope.searchingAgain = function () {
console.log('Searching ...');
$scope.searching = true;
}
}]);
The problem is that when the searchbox input is disabled the ng-click
never fire, so i can acivate again the search funcionality.
Can someone help me to find a solution for this? Thanks.