大佬教程收集整理的这篇文章主要介绍了Angularjs ui-select在指令中使用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_8@
var myApp = angular.module('MyApp',['ui.SELEct','ngSanitize']); myApp.directive('timezone',function () { return { reStrict: 'AE',template: '<ui-SELEct theme="bootstrap" ng-model="tzModel" style="min-width: 300px;"> <ui-SELEct-match placeholder="SELEct a timezone in the list">{{$SELEct.SELEcteD}}</ui-SELEct-match> <ui-SELEct-choices repeat="tz in timezones | filter: $SELEct.search"> <div ng-bind-html="tz"></div> </ui-SELEct-choices> </ui-SELEct>',scope: { tzModel : '=',},link: function(scopE) { scope.timezones = ["Africa/Abidjan","UTC"]; } }; });@H_403_8@我的控制器:
@H_403_8@
@H_931_8@myApp.controller('MyCtrl',function ($scope) { $scope.foo = {name:"Africa/Abidjan"}; }); @H_403_8@这是我在html中使用它的方式:@H_403_8@
<div ng-app="MyApp" ng-controller="MyCtrl"> {{foo}}<br /> <timezone tz-model="foo.name" /> </div>@H_403_8@问题是,当我从下拉列表中选择一个新值时,我的控制器对象不会更新.
@H_403_8@https://github.com/angular-ui/ui-select/wiki/FAQs#ng-model-not-working-with-a-simple-variable-on-scope
@H_403_8@
<timezone tz-model="foo" /> <ui-SELEct theme="bootstrap" ng-model="tzModel.name" ...@H_403_8@https://jsfiddle.net/XyUGE/264/
以上是大佬教程为你收集整理的Angularjs ui-select在指令中使用全部内容,希望文章能够帮你解决Angularjs ui-select在指令中使用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。