小编And*_*das的帖子

Facebook分享通过FB.ui

我正在尝试使用我根据新文档编写的以下代码来显示"发布到源"对话框(https://developers.facebook.com/docs/javascript/reference/FB.ui)但我得到了以下错误" ReferenceError:FB未定义 "

我使用的代码是最简单的我可以提出:

window.fbAsyncInit = function() {     
    FB.init({
      appId      : 'xxxxxxxx',
      status     : true,
      xfbml      : true
    });
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "http://connect.facebook.net/en_US/all.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));


    FB.ui({
        method: 'feed',
        name: 'Facebook Dialogs',
        link: 'https://developers.facebook.com/docs/dialogs/',
        picture: 'http://fbrell.com/f8.jpg',
        caption: 'Reference Documentation',
        description: 'Dialogs provide a simple, consistent interface for applications to interface with users.'
    });
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

编辑1

如果我想在用户点击链接时打开对话框,我将使用jquery click事件

$(".userActions a.facebook").click(function() …
Run Code Online (Sandbox Code Playgroud)

javascript facebook-javascript-sdk fb.ui

6
推荐指数
1
解决办法
3万
查看次数

ng-pattern 密码匹配

您好,正在创建一个注册表单,我想使用 Angular 检查用户输入的密码是否匹配。我的所有验证都有效(必需,最小和最大长度),但我总是收到密码不匹配的错误。

我的代码如下

<div class="control-group">
<label class="control-label">Password</label>
<div class="controls" ng-class="{ 'has-error': addCustomerForm.password_1.$touched && addCustomerForm.password_1.$invalid }">
    <input type="text" name="password_1" class="form-control input-lg" ng-model="newCustomerInfo.password_1" ng-minlength="4" ng-maxlength="12" required>
    <div ng-messages="addCustomerForm.password_1.$error" ng-if="addCustomerForm.password_1.$touched">
        <div ng-message="required">This field is required</div>
        <div ng-message="minlength">The password is too short.</div>
        <div ng-message="maxlength">The password is too long.</div>
    </div> 
</div>
</div>


<div class="control-group">
<label class="control-label">Password (Confirm)</label>
<div class="controls" ng-class="{ 'has-error': addCustomerForm.password_2.$touched && addCustomerForm.password_2.$invalid }">
    <input type="text" name="password_2" class="form-control input-lg" ng-model="newCustomerInfo.password_2" ng-minlength="4" ng-maxlength="12" ng-pattern="/^{{password_1}}$/" required>
    <div ng-messages="addCustomerForm.password_2.$error" ng-if="addCustomerForm.password_2.$touched">
        <div ng-message="required">This field is required</div>
        <div …
Run Code Online (Sandbox Code Playgroud)

angularjs ng-pattern ng-messages

1
推荐指数
1
解决办法
4845
查看次数