demo20230512/Browser_Local/js/Directive/CommonSearch.js

21 lines
686 B
JavaScript
Raw Normal View History

2023-05-12 10:20:28 +08:00
var arr = window.location.href.split("/");
if (arr[3].indexOf('app') == 0)
baseUrl = '';
else
baseUrl = '/' + arr[3];
angular.module('View.Directive')
.directive('commonSearch', function () {
return {
restrict: 'E',
templateUrl: baseUrl+'/Partials/templates-common_search',
scope: {
passedFetchData: '&' // get fetch function from controller
},
link: function ($scope) {
$scope.searchText = "";
$scope.search = function () {
$scope.passedFetchData({ searchText: $scope.searchText });
};
}
};
});