AngularJS、ui路由器和引导模式
在选择选项时显示模式窗口存在一些问题 HTML 家庭控制器AngularJS、ui路由器和引导模式,angularjs,angular-ui-router,angular-ui-bootstrap,Angularjs,Angular Ui Router,Angular Ui Bootstrap,在选择选项时显示模式窗口存在一些问题 HTML 家庭控制器 angular.module('myApp', ['ui.router']) .config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider){ $urlRouterProvider.otherwise('/'); $stateProvider
angular.module('myApp', ['ui.router'])
.config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider){
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home',{
url: '/',
templateUrl: 'contacts.html',
controller: 'myCtrl'
})
}])
angular.module('myApp', [])
.controller('myCtrl', function($http, $scope) {
$http.get('test.json').success(function (data) {
$scope.selected = data;
});
});
contacts.html
<select ng-model="selectedRegion" data-ng-options="location for location in selected.regions">
<option value="">Region</option>
</select>
<select ng-model="selectedCountry" data-ng-options="place for place in selected.countries[selectedRegion]">
<option value="">Country</option>
</select>
{{selectedRegion}}
如何创建一个模式窗口,在选择相关地区或国家后,在该窗口中显示{{selectedRegion}}?
请帮助,我尝试注入['ui.bootstrap',ng点击按钮工作正常。但是如何用select实现这一点呢?谢谢
这里是从你给的砰砰声中,有一些工作要做 将home.js中的angular.module'myApp',[]替换为angular.module'myApp' 在国家/地区列表中添加ng更改。 在更改时,我们将打开一个模式
添加ui.bootstrap作为模块依赖项,用于模式,但演示中没有可用的模式,并且由于两次声明相同的模块,演示被破坏。用零钱换你要的东西是的,对不起,摔坏了,错过了。感谢您的帮助,我尝试使用ng click指令创建它,发现它应该使用SelectThank应用ng change指令,非常感谢,很抱歉不能使用plunk,错过了它
<select ng-model="selectedRegion" data-ng-options="location for location in selected.regions">
<option value="">Region</option>
</select>
<select ng-model="selectedCountry" data-ng-options="place for place in selected.countries[selectedRegion]">
<option value="">Country</option>
</select>
{{selectedRegion}}