码迷,mamicode.com
首页 > 其他好文 > 详细

angular service/directive

时间:2014-08-06 18:41:51      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   java   io   art   ar   

 

 

<html class=" js cssanimations csstransitions" ng-app="phonecatApp" >
    <head>
        <title>{{title}}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="/scripts/service/css/font.css" rel="stylesheet" type="text/css">
        <link href="/scripts/service/css/style.css" rel="stylesheet" type="text/css" media="all">
        <link rel="stylesheet" type="text/css" href="/scripts/service/css/magnific-popup.css">

    </head>
<body ng-controller="controller1">

 

 

                            <div class="cart">
                                <a class="popup-with-zoom-anim" href ng-click="callNotify(‘message‘);">NOTIFY</a>
                            </div>

 

 

  <!--<div my-Directive></div>
    {{title}}-->
        <script type="text/javascript" src="/Scripts/angular.min.js"></script>    
        <script type="text/javascript">
            var phonecatApp = angular.module(‘phonecatApp‘, []);

            phonecatApp.controller(‘controller1‘, [‘$scope‘, ‘notify‘, function ($scope,notify) {
                $scope.title = "Compare";
                $scope.click1 = function () { alert(‘abc‘); };
                $scope.callNotify = function (msg) {
                    notify(msg);
                };
                $scope.phones = [
                  {
                      ‘name‘: ‘Nexus S‘,
                      ‘snippet‘: ‘Fast just got faster with Nexus S.‘
                  },
                  {
                      ‘name‘: ‘Motorola XOOM™ with Wi-Fi‘,
                      ‘snippet‘: ‘The Next, Next Generation tablet.‘
                  },
                  {
                      ‘name‘: ‘MOTOROLA XOOM™‘,
                      ‘snippet‘: ‘The Next, Next Generation tablet.‘
                  }
                ];
            }]);

            phonecatApp.directive(‘myDirective‘, function () {
                return {
                    template: ‘Name: {{phones[0].name}}‘
                };
            });

            phonecatApp.factory(‘notify‘, [‘$window‘, function (win) {
                return function (msg) {
                    console.log(‘function in service ‘ + msg);
                    return false;
                };
            }]);
        </script>

 

angular service/directive,布布扣,bubuko.com

angular service/directive

标签:style   blog   http   color   java   io   art   ar   

原文地址:http://www.cnblogs.com/zyip/p/3895165.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!