小编Xee*_*een的帖子

未知提供者:$ modalProvider < - AngularJS的$ modal错误

我一直在收到这个错误,因为我正在尝试实现bootstrap Modal窗口.可能是什么原因造成的?我在http://angular-ui.github.io/bootstrap/#/modal复制/粘贴了所有内容.

javascript modal-dialog angularjs

96
推荐指数
5
解决办法
9万
查看次数

获取无法使用bootstrap轮播脚本读取未定义的属性'offsetWidth'

我创建了一个carouselwith Bootstrap 3.3并且它可以在我的本地机器上运行,但是当我在服务器上传整个东西时,其中bootstrap js文件与其他文件一起编译在一个文件中,我收到此错误:

Cannot read property 'offsetWidth' of undefined - 有没有人面对这个问题,是否有任何已知的解决方案?

javascript jquery twitter-bootstrap

65
推荐指数
3
解决办法
9万
查看次数

尝试创建扩展时出现PostgreSQL错误

ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory

当我试图CREATE EXTENSION postgis;能够告诉我为什么会这样,我能做些什么来解决它时,我得到了什么?

database postgresql

48
推荐指数
5
解决办法
5万
查看次数

未捕获的ReferenceError:使用FB.getLoginStatus时未定义FB

我正在尝试检查用户是否已使用Facebook登录并在JS控制台中获取该错误.我的代码看起来像这样:

<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function () {
        FB.init({
            appId: '######', // App ID
            status: true, // check login status
            cookie: true, // enable cookies to allow the server to access the session
            xfbml: true  // parse XFBML
        });
    };

    // Load the SDK Asynchronously
    (function (d) {
        var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js";
        d.getElementsByTagName('head')[0].appendChild(js);
    }(document));

    FB.getLoginStatus(function (response) {
        if (response.status === 'connected') …
Run Code Online (Sandbox Code Playgroud)

javascript facebook facebook-login

30
推荐指数
3
解决办法
8万
查看次数

如何通过AngularJS模板输出html?

<h1>{{ revision.title }}</h1>

<div ng-bind-html="revision.content"></div>
Run Code Online (Sandbox Code Playgroud)

标题输出正常,但内容 - 没有.它有一些html,我得到以下错误:Attempting to use an unsafe value in a safe context.这被描述如下:http://docs.angularjs.org/error/ $ sce:unsafe,那很好,但那我怎么能输出那里的内容将是一些HTML,因此我必须将其设置为{{ revision.content | safe }}或smthn.什么是正确的方法?

编辑:

AngularJS版本:1.2

html javascript templates view angularjs

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

如何测试依赖::用RSpec破坏?

我想测试一下我的User模型协会has_many :projects, dependent: :destroy,现在已经走了这么远:

it "destroys dependent projects" do
  user = FactoryGirl.build(:user)
  project = FactoryGirl.build(:project)

  user.projects << project
  user.destroy

  expect(Project.count).to change(-1)
end
Run Code Online (Sandbox Code Playgroud)

但是这给出了一个错误:

Failure/Error: expect(Project.count).to change(-1)
     ArgumentError:
       `change` requires either an object and message (`change(obj, :msg)`) or a block (`change { }`). You passed an object but no message.
Run Code Online (Sandbox Code Playgroud)

所以我认为这change不是正确的匹配器,是吗?你能否告诉我如何在没有出现错误的情况下编写此测试?

ruby testing unit-testing rspec ruby-on-rails

22
推荐指数
2
解决办法
9479
查看次数

缺少共享文件夹的主机路径:〜/ Code

我想laravel homestead用于我的开发机器并成功安装了virtualbox和vagrant,但是当我运行时vagrant up我收到此错误:

Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The host path of the shared folder is missing: ~/Code
Run Code Online (Sandbox Code Playgroud)

Homestead.yaml文件如下所示:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public
      hhvm: true

databases:
    - homestead

variables:
    - key: APP_ENV
      value: …
Run Code Online (Sandbox Code Playgroud)

virtualbox development-environment vagrant laravel homestead

13
推荐指数
2
解决办法
2万
查看次数

Angularjs if/else语句

<div class="company_name" ng-controller="CompanyName">
 <h1 class="left">
     {{data.company_name}}
 </h1>
</div>
Run Code Online (Sandbox Code Playgroud)

我想做的是,如果没有通过输入字段添加data.company_name,它会显示占位符"公司名称",如何使用angularjs完成?

conditional-statements angularjs

9
推荐指数
1
解决办法
10万
查看次数

如何在自定义挂钩上使用 useCallback?

我需要这个:const setError = useError();作为 中的依赖项useEffect,但由于此函数也在其他地方使用(在同一组件内),因此每当抛出错误时,我useEffect api都会重新获取数据。

我应该禁用该react-hooks/exhaustive-deps规则还是有什么办法可以解决这个问题?如果我尝试将其包装起来,useCallback则会收到一条错误消息,表明钩子只能在组件本身内使用。

编辑

export const useError = (): ((error: any, title?: string) => void) => {
  const dispatch = useDispatch();
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  const setError = (error: any, title = 'Error'): void => {
    Sentry.captureException(error);
    const bodyText = error.message || error;
    const errorTitle = error.name || title;
    dispatch(
      setNotification({
        type: notificationTypes.prompt,
        title: errorTitle,
        bodyText,
        className: 'error',
        show: true,
      })
    );
  };

  return setError;
};
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs redux enzyme react-hooks

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

如何嵌入instagram个人资料?

我已经找到了几百种方法在网站中嵌入Instagram库,但我需要的是嵌入整个配置文件,如果你看一下这个配置文件,例如:https://www.instagram.com/exampleprofile/这里有一个个人资料图片,关于,标题和关注按钮.

如何使用此标题信息嵌入配置文件以及其图库中的图像?它甚至可能吗?

php embed iframe instagram instagram-api

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