Html:
<search-bar ng-model="search"></search-bar>
app.js:
.directive('searchBar', [function () {
return {
scope: {
ngModel: '='
},
require: ['^ionNavBar', '?ngModel'],
restrict: 'E',
replace: true,
template: '<ion-nav-buttons side="right">'+
'<div class="searchBar">'+
'<div class="searchTxt" ng-show="ngModel.show">'+
'<div class="bgdiv"></div>'+
'<div class="bgtxt">'+
'<input type="text" placeholder="Search..." ng-model="productObject.searchAgenda">'+
'</div>'+
'</div>'+
'<i class="button button-clear" ng-class="{\'icon-disabled-opacity\' : showdate}" ng-click="updateSelection();" title="Show all dates">All</i>'+
'</div>'+
'</ion-nav-buttons>',
compile: function (element, attrs) {
var icon=attrs.icon
|| (ionic.Platform.isAndroid() && 'ion-android-search')
|| (ionic.Platform.isIOS() && 'ion-ios7-search')
|| 'ion-search';
angular.element(element[0].querySelector('.icon')).addClass(icon);
return function($scope, $element, $attrs, ctrls) {
var navBarCtrl = ctrls[0];
$scope.navElement = $attrs.side === 'right' ? navBarCtrl.rightButtonsElement : navBarCtrl.leftButtonsElement;
};
}
};
}])
yourCTRL.js:
app.controller('searchBarCtrl', function($scope,$ionicNavBarDelegate){
var title, definedClass;
$scope.$watch('ngModel.show', function(showing, oldVal, scope) {
if(showing!==oldVal) {
if(showing) {
if(!definedClass) {
var numicons=$scope.navElement.children().length;
angular.element($scope.navElement[0].querySelector('.searchBar')).addClass('numicons'+numicons);
}
title = $ionicNavBarDelegate.getTitle();
$ionicNavBarDelegate.setTitle('');
} else {
$ionicNavBarDelegate.setTitle(title);
}
} else if (!title) {
title = $ionicNavBarDelegate.getTitle();
}
});
});
<search-bar ng-model="search"></search-bar>
app.js:
.directive('searchBar', [function () {
return {
scope: {
ngModel: '='
},
require: ['^ionNavBar', '?ngModel'],
restrict: 'E',
replace: true,
template: '<ion-nav-buttons side="right">'+
'<div class="searchBar">'+
'<div class="searchTxt" ng-show="ngModel.show">'+
'<div class="bgdiv"></div>'+
'<div class="bgtxt">'+
'<input type="text" placeholder="Search..." ng-model="productObject.searchAgenda">'+
'</div>'+
'</div>'+
'<i class="button button-clear" ng-class="{\'icon-disabled-opacity\' : showdate}" ng-click="updateSelection();" title="Show all dates">All</i>'+
'</div>'+
'</ion-nav-buttons>',
compile: function (element, attrs) {
var icon=attrs.icon
|| (ionic.Platform.isAndroid() && 'ion-android-search')
|| (ionic.Platform.isIOS() && 'ion-ios7-search')
|| 'ion-search';
angular.element(element[0].querySelector('.icon')).addClass(icon);
return function($scope, $element, $attrs, ctrls) {
var navBarCtrl = ctrls[0];
$scope.navElement = $attrs.side === 'right' ? navBarCtrl.rightButtonsElement : navBarCtrl.leftButtonsElement;
};
}
};
}])
yourCTRL.js:
app.controller('searchBarCtrl', function($scope,$ionicNavBarDelegate){
var title, definedClass;
$scope.$watch('ngModel.show', function(showing, oldVal, scope) {
if(showing!==oldVal) {
if(showing) {
if(!definedClass) {
var numicons=$scope.navElement.children().length;
angular.element($scope.navElement[0].querySelector('.searchBar')).addClass('numicons'+numicons);
}
title = $ionicNavBarDelegate.getTitle();
$ionicNavBarDelegate.setTitle('');
} else {
$ionicNavBarDelegate.setTitle(title);
}
} else if (!title) {
title = $ionicNavBarDelegate.getTitle();
}
});
});
Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.Nice article i was really impressed by seeing this article, it was very interesting and it is very useful for me.
ReplyDeleteAngularjs Training In Hyderabad
The combination of technologies like JavaScript, NodeJS, PHP, Angular, Ionic, and React is very powerful for building modern applications with high performance and flexibility. Similarly, Oracle Fusion HCM Online Training equips professionals with the right practical knowledge and skills to handle complex cloud-based HR processes, making it highly valuable for career growth in today’s IT landscape.
ReplyDeleteOracle Fusion HCM Online Training
If you're looking for top-quality dental treatment in Nizampet, Nizampet Dentist is your premier destination. Led by the skilled Dr. Sri Lakshmi, the clinic offers comprehensive services—ranging from root canal therapy and dental implants to braces, cosmetic dentistry, and children’s dental care. With modern equipment like 3D imaging, digital X-rays, and a patient-first approach, they deliver comfortable, effective, and personalized care for every smile.
ReplyDeletebest dental hospital nizampet
Looking for a strong and natural way to replace missing teeth? Dental implant treatment in Nizampet offers a safe and long-lasting solution. At Nizampet Dentist, skilled implant specialists use advanced technology to give you a confident smile. Implants look and feel like real teeth and help protect your jawbone. Book a consultation to get your personalized treatment plan today.
ReplyDeletedental implant treatment in nizampet
Root Canal Treatment in Nizampet helps save damaged or infected teeth instead of removing them. At Nizampet Dentist, expert dentists use advanced and painless methods to clean and protect the tooth. This treatment relieves pain, stops infection, and keeps your natural smile safe for years.
ReplyDeleteRoot Canal Treatment in Nizampet
Invisalign providers in Nizampet offer clear, removable aligners that gently move your teeth into the right position. At Nizampet Dentist, skilled orthodontists create custom treatment plans using advanced 3D scans. Invisalign is comfortable, nearly invisible, and perfect for improving your smile without metal braces.
ReplyDeleteinvisalign providers in nizampet
Invisible Aligners Treatment in Nizampet offers a clear and comfortable way to straighten teeth. At Nizampet Dentist, expert dentists use advanced 3D scans to create custom aligners that gently move your teeth into place. They are removable, painless, and perfect for busy teens and adults. Start your journey to a confident smile today.
ReplyDeleteinvisible aligners treatment in nizampet