Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

FInd html templates at the script path level #51

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/multiselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,23 @@ angular.module('ui.multiselect', [])
scope: false,
replace: true,
templateUrl: function (element, attr) {
return attr.templateUrl || 'multiselect.tmpl.html';
},

var scripts = document.getElementsByTagName("script");
var filePath = '';

for(var scriptKey in scripts){
var currentScriptPath = scripts[scriptKey].src;
var fileMatch = currentScriptPath.match('multiselect.js');

if( fileMatch ){
filePath = currentScriptPath.slice(0, fileMatch.index);
break;
}

}

return attr.templateUrl || filePath+'multiselect.tmpl.html';
},
link: function (scope, element, attrs) {

scope.isVisible = false;
Expand Down