Answer the question
In order to leave comments, you need to log in
How to correctly implement a tab change when following a direct link?
There is such a routing
app.config(function ($routeProvider) {
$routeProvider.
when('/', {templateUrl: './src/tmp/profile.html'}).
when('/friends', {templateUrl: './src/tmp/friends.html'}).
otherwise({redirectTo: './src/tmp/profile.html'});
});
app.controller('TabController', function ($location) {
this.tab = 1;
this.setTab = function (tabId, path) {
this.tab = tabId;
$location.path(path);
};
this.isSet = function (tabId) {
return this.tab === tabId;
};
});
Answer the question
In order to leave comments, you need to log in
When accessing friends directly, a server is running that tries to serve content at this URL. so it is necessary to resolve this problem at the server level. For example, I redirect all calls to / i.e. content is loaded first from / and then Angular already routes to the desired template
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question