Within my Angular application, I have implemented a service to facilitate communication between 2 controllers and allow them to share the input variable from the search box.
I am using kickSearch.box
to reference memory...obj.property
. However, there seems to be an issue where updates to kickSearch.box
do not reflect in $scope.searchBox
:
angular.module('ucp.kick').controller('kickSearch', function($scope, $location, kickSearch) {
initialize = function() {
var terms;
$scope.searchBox = kickSearch.box;
terms = $location.search().device || $location.search().dc || [];
kickSearch.box = _.isArray(terms) ? terms.join(" ") : terms;
if ($scope.searchBox.length) {
return $scope.submitSearch();
}
};
initialize();
<input type="text" class="form-control" placeholder="Enter device #" ng-model="searchBox" >