Skip to content

Instantly share code, notes, and snippets.

@overbyte
Last active December 21, 2016 10:10
Show Gist options
  • Save overbyte/e045773f68408e09bb80402389fbf722 to your computer and use it in GitHub Desktop.
Save overbyte/e045773f68408e09bb80402389fbf722 to your computer and use it in GitHub Desktop.
/**
** To Allow relative template paths, we wrap the component in a function that receives the path to the
** currently executing script (minus the actual filename)
**/
(function (currentScriptPath) {
'use strict';
angular
.module('module.name')
.component('startupView', {
templateUrl: currentScriptPath + '/startup.view.html',
bindings: {},
controller: function StartupCtrl() {
var ctrl = this;
ctrl.$onInit = function () {
};
ctrl.$onDestroy = function () {
};
}
});
})(
(function () {
var scripts = document.getElementsByTagName( 'script' );
var currentScriptPath = scripts[scripts.length - 1].src;
return currentScriptPath.substring(0, currentScriptPath.lastIndexOf('/'));
})()
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment