使用客户端人员选取器时未定义的作用域

Undefined scope when using client side People Picker

本文关键字:未定义 作用域 选取 客户端      更新时间:2023-09-26

>我正在使用以下指令,但收到"未定义"错误,为什么我尝试控制台.log或提醒 $scope.cc 的值

https://github.com/jasonvenema/sharepoint-angular-peoplepicker

下面是该字段的 HTML。有谁知道为什么这会记录为未定义?

<sp-people-picker name="CC" id="CC" ng-model="$scope.cc" min-entries="1" max-entries="20" allow-duplicates="false" show-login="false" show-title="true" min-characters="2" app-web-url="$scope.spAppWebUrl" />

若要访问作用域中的模型集,无需在视图中指定$scope。

您需要将 html 更新到

<sp-people-picker name="CC" id="CC" ng-model="cc" min-entries="1" max-entries="20" allow-duplicates="false" show-login="false" show-title="true" min-characters="2" app-web-url="{{spAppWebUrl}}" />