首页 > 代码库 > angular service/directive
angular service/directive
<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="http://www.mamicode.com/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>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。