简体   繁体   English

AngularJs模板和内容共享

[英]AngularJs template and content sharing

I am creating simple mobile App using Ionic framework and AngularJs. 我正在使用Ionic框架和AngularJs创建简单的移动应用程序。 I have AngularJs view for "single item". 我有“单个项目”的AngularJs视图。 I that view I have: 我认为我有:

<script> js of social sharing plugin </script>

My social sharing plugin offers config for url and title of data that will be shared: 我的社交共享插件为将要共享的数据的URL和标题提供了配置:

<script>

Init.share('.share,
{

  url: '',
  title: ''

});
</script>

How can I combine AngularJs interpolated data in script config, something like this (any sugestions): 我该如何在脚本配置中组合AngularJs插值数据,如下所示(任何提示):

  <script>

Init.share('.share,
{

  url: {{data.url}},
  title: {{data.title}}

});
</script>

You can access your variables in your controller using the $scope object. 您可以使用$scope对象在控制器中访问变量。 Like $scope.data.url 就像$scope.data.url

This is a very nice tutorial to start with Angular. 从Angular开始, 是一个非常不错的教程。

This is one of the most famous plugin for social sharing using cordova/phonegap apps 是使用Cordova / Phonegap应用进行社交共享的最著名插件之一

Then you can do something like this in your view: 然后,您可以在视图中执行以下操作:

<a ng-click="share()">share this</a>

And in your controller you can do this 在您的控制器中,您可以执行此操作

$scope.share = function() {
            window.plugins.socialsharing.share('Text to be shared', null, null, 'http://url.here');
        };

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM