N
N
Nick Nesterov2015-12-09 13:56:35
Angular
Nick Nesterov, 2015-12-09 13:56:35

Problem with templateUrl in minification directive, who faced it?

I'm used to creating directives in three files. In one html, in the other lies the body of the directive itself, and in the third the controller.
It looks something like this:
mydirective.html:

<my-dir ng-controller="MyDirCtrl">Тут остальной хтмл<myDir>

mydirective.js
app.directive('myDir', function() {
return {
restrict: 'AE',
templateUrl: 'templates/mydirective.html',
// тут остальной js
}
});

mydirectivectrl.js
app.controller('MyDirCtrl', [ '$scope', function($scope) {
//тут остальной js
}]);

Everything worked fine before minification. After minification, naturally the url in templateUrl disappeared. What is the way out of this situation? I don't really want to rewrite everything. For example, change templateUrl to template and in the directive.
Who faced a similar situation?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nick Nesterov, 2015-12-10
@njnesterov

Everything, I figured everything out. It turned out that the problem was not entirely in the minifier. It compressed links with in templateUrl in directives normally. I had the following thing in my controller:
After minification, there is no such link in current.templateUrl anymore.

S
Sergey, 2015-12-09
Protko @Fesor

naturally the url in templateUrl has disappeared

it's not natural. No minifier will remove properties.

L
lega, 2015-12-09
@lega

After minification, naturally the url in templateUrl disappeared.
If the minifier cuts out significant parts (templateUrl), then throw this minifier to the dump (try others).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question