Open angelozerr opened 10 years ago
That would be really nice but also quite complex to implement because there are different situation :
$routeProvider
is used to link templates and controllers , like : $routeProvider.when('/contacts', {
templateUrl : 'partials/contact/search.html',
controller : SearchContactController
Here we need to parse the $routeProvider
$stateProvider
is used, like : .state('tab.dash', {
url: '/dash',
views: {
'tab-dash': {
templateUrl: 'templates/tab-dash.html',
controller: 'DashCtrl'
}
}
})
There are probably other ways to bind controllers to template which I'm not aware of.
I know it's not an easy task (taht's why I had implemented link 'at hand').
But I would like to really improve (at first) templateUrl with this issue but with the following issue https://github.com/angelozerr/angularjs-eclipse/issues/103 (completion for templateUrl).
But to do that I need that tern support object litteral with clean mean (pay the author of tern.js to support that?)
@sebastienblanc I will start this feature but I will manage for the moment 2 cases :
app.directive("zippy", function(){
return {
restrict: "E",
transclude: true,
scope: {
title: "@"
},
templateUrl: "zippy.html",
link: function(scope){
scope.isContentVisible = false;
scope.toggleContent = function(){
scope.isContentVisible = !scope.isContentVisible;
};
};
};
});
$routeProvider.when('/contacts', {
templateUrl : 'partials/contact/search.html',
controller : SearchContactController
$stateProvider is not a part of angular, but an extension (so I will not manage it for the moment). I have created an issue for that https://github.com/angelozerr/angularjs-eclipse/issues/137
See https://thinkster.io/egghead/templateurl/ for a sample with templateUrl.
When templateUrl is used, today link between HTML file and JS controller is done at hand https://github.com/angelozerr/angularjs-eclipse/wiki/Angular-Explorer-View#user-content-html-template-linkunlink
It should be cool if tern plugin angular.js could retrieve the link between HTML template and controller : link will be done automaticly without doing at hand.