AngularJS和Angular-Snap:未定义Snap构造函数

时间:2016-04-06 10:53:28

标签: javascript angularjs snapjs

"确保使用SnapConstructorProvider.use(MySnap)定义window.Snap或提供自己的。"

当我尝试使用棱角分距时,我拥有的是什么。我跟着他们在github上说的话,但仍然没有工作。我可以帮忙吗?我看了角度捕捉代码,我看到了一个测试:

if(angular.isUndefined(S)) {
      throw new Error('Snap constructor is not defined. Make sure ' +
          'window.Snap is defined or supply your own with ' +
          'SnapConstructorProvider.use(MySnap).');
    }

当我放置一个angular.isUndefined的console.log时,它返回true但我不知道为什么。

这里是html:

    <!DOCTYPE html>
<html ng-app="myApp">
<head>
    <meta charset=utf-8 />
    <title>AO</title>
  <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap-theme.min.css" />
  <link rel="stylesheet" type="text/css" media="screen" href="css/angular-snap.min.css" />
    <!--[if IE]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body>

  <snap-drawer>
    <p>I'm a drawer ! I maybe I've got some sweet navigation links.</p>
  </snap-drawer>

  <snap-content>
    <p>Hello! I'm your main content!</p>
  </snap-content>


  <script type="text/javascript" src="js/angular.min.js"></script>
  <script type="text/javascript" src="js/snap.js"></script>
  <script type="text/javascript" src="js/angular-snap.min.js"></script>
  <script type="text/javascript" src="js/app.js"></script>

</body>
</html>

Javascript代码:

var app = angular.module('myApp', ['snap']);

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

您必须将snap.js库包含到index.html页面

DECLARE @set varchar(10);
SET @set = '1,4,2';

;WITH S AS
( 
  select 
  cast(parsename(revset,1)as int) as n1,
  cast(parsename(revset,2)as int) as n2,
  cast(parsename(revset,3)as int) as n3
  from (
     select replace(reverse(@set),',','.') revset
     ) q
),
N AS
(
   select 1 as n
   union all
   select n+1
   from N, S 
   where (N.n < S.n1 or N.n < S.n2 or N.n < S.n3)
)
select 
concat(nr1.n,',',nr2.n,','+cast(nr3.n as varchar(2))) as [Sets]
from S 
join N nr1 on (nr1.n <= S.n1)
join N nr2 on (nr2.n <= S.n2)
left join N nr3 on (nr3.n <= S.n3)
order by nr3.n, nr2.n, nr1.n;