0
.controller('MyController', ['$scope', '$http', '$timeout',
function($scope, $http, $timeout) {
$timeout(function(){
$scope.domainModal.show();
});
$timeout(function(){
$scope.loginModal.show();
});
$scope.baseURL = $localStorage.getObject('baseURL', '{}');
$http.get($scope.baseURL.url+"Stuff/").success(
function(response) {
$scope.stuff = response;
},
由于某些原因, 基本上,我有两个模态,第一个是设置baseURL.url的domainModal和一个登录模态。因此,用户选择baseURL,然后该URL用于调用baseURL.url +“/ Stuff”。但是,它不会马上起作用。 baseURL.url也存储在本地存储中,但是当我从本地存储获得该URL时,URL会随机出现随机数字和单词对象。 总之,如果设置了baseURL.url,那么只有当我按下Web浏览器上的刷新时,它才会起作用,我想是因为它在完成domainModal.show()之前已经读取了整个控制器。
你能发表你设置'baseUrl.url'的代码吗? – e666