首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将$scope添加到<script></script>中的url params中

将$scope添加到<script></script>中的url params中
EN

Stack Overflow用户
提问于 2017-03-21 11:10:48
回答 1查看 100关注 0票数 0

在我的angularjs应用程序中,我有一个用于mibew聊天的脚本,在我的身体里,我的脚本在哪里?

代码语言:javascript
复制
<script type="text/javascript">Mibew.ChatPopup.init({"id":"58cfa9cad9451969","url":"http://steora.com\/mibew-chat\/chat?locale=en&email={{authentication .username}}.com&name={{authentication .username}}","preferIFrame":true,"modSecurity":false,"width":640,"height":480,"resizable":true,"styleLoader":"\/mibew-chat\/chat\/style\/popup"});

我需要设置用户名和电子邮件{{authentication .username}{{authentication .email}}

在我的indexCtrl.js中我这样做

代码语言:javascript
复制
$scope.authentication.username = 'Tom';
$scope.authentication.email= 'tom@gmail.com';

但这不管用。

有人能告诉我如何调整数据的范围吗?

编辑:我尝试使用@KoIIIeY的解决方案,但是如果我尝试使用它,每次我点击聊天图标时,它就会在新选项卡中打开,而不是弹出,电子邮件和用户名中也没有数据。我需要找到解决方案--如何从控制器传递这些数据

代码语言:javascript
复制
$scope.authentication.username = 'Tom';

$scope.authentication.email= 'tom@gmail.com';

敬index.html。

代码语言:javascript
复制
<script type="text/javascript">Mibew.ChatPopup.init({"id":"58cfa9cad9451969","url":"http://steora.com\/mibew-chat\/chat?locale=en&email=_____HERE_____&name=____HERE____","preferIFrame":true,"modSecurity":false,"width":640,"height":480,"resizable":true,"styleLoader":"\/mibew-chat\/chat\/style\/popup"})></script>
EN

回答 1

Stack Overflow用户

发布于 2017-03-21 11:18:17

在indexCtrl.js中

代码语言:javascript
复制
$scope.init = function(){
    Mibew.ChatPopup.init({"id":"58cfa9cad9451969","url":"http://steora.com\/mibew-chat\/chat?locale=en&email="+$scopeauthentication.email+".com&name="+$scopeauthentication.username+"","preferIFrame":true,"modSecurity":false,"width":640,"height":480,"resizable":true,"styleLoader":"\/mibew-chat\/chat\/style\/popup"});
}

在望

代码语言:javascript
复制
<body ng-init="init()"></body>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42925410

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档