angularjs-directive

jquery UI datepicker is missing style/css

混江龙づ霸主 提交于 2019-12-25 01:55:35
问题 I just googled this datepicker for use in angular. The problem is that the style/css is missing: myApp.directive('calendar', function () { return { require: 'ngModel', link: function (scope, el, attr, ngModel) { $(el).datepicker({ dateFormat: 'yy-mm-dd', onSelect: function (dateText) { scope.$apply(function () { ngModel.$setViewValue(dateText); }); } }); } }; }) Does anyone know how to fix the style? Looks like jquery ui css or something? jsfiddle: http://jsfiddle.net/dingen2010/a6WDH/1/ 回答1:

Can $watch 'miss'?

↘锁芯ラ 提交于 2019-12-25 01:48:56
问题 We have the following directive: app.directive("counterWidget",function(){ return{ restrict:"E", scope:{ startnumber: '=', resetter: '=' }, link:function(scope,elem,attr){ scope.f = attr.startnumber; scope.add = function(){ scope.f++ } scope.remove = function(){ scope.f-- } scope.reset = function(){ scope.f = attr.startnumber scope.$parent.triggerReset() } scope.$watch(function(attr) { return attr.resetter }, function(newVal) { if (newVal === true) { scope.f = attr.startnumber; } }) },

Pull to refresh in Angular Js

最后都变了- 提交于 2019-12-25 01:45:35
问题 I am using the pull to refresh plugin for Angular JS. But it is not working. I can see the text, but when I try to pull, nothing happens! I completed all the steps documented on this GitHub page: https://github.com/mgcrea/angular-pull-to-refresh. I have included all the files(plugins/pulltorefresh/angular-pull-to-refresh.js,plugins/pulltorefresh/angular-pull-to-refresh.css,plugins/pulltorefresh/angular-pull-to-refresh.tpl.js,plugins/pulltorefresh/angular-pull-to-refresh.tpl.css) in project.

AngularJS directive for dependant select element

試著忘記壹切 提交于 2019-12-25 01:36:32
问题 I'm trying to write a directive for dependant select elements. The relationship is Country > States > Cities . When element with class country get changed I should update element with class states and the same behavior for element with class city . To get the states I only need the country id and for get cities I need country and state id's. So I did this code: app.directive('country', ['$http', function($http) { return { restrict: 'C', link: function(scope, element, attrs) { element.change

how to add different head two tags or different head information for my two directive

℡╲_俬逩灬. 提交于 2019-12-25 01:33:10
问题 I have main.cshtml file It has a head tag which includes css and js references. I have two directives / templates. I want to have different two title. When page1 opened (has template1) I want page's title to be Page-1. When page2 opened (has template2) I want page's title to be Page-2. I tried to put head tags to directive but it doesn't read title and icon-for-title. <div style="height: 100%"> <head> <title>{{::title}}</title>}} <link rel="shortcut icon" href="../../../../icons/icon1.ico"> <

Listen for broadcast in sub directive

三世轮回 提交于 2019-12-25 01:13:51
问题 I'm new to AngularJS and need some help. I have two directives (parent and child). When I click a link, the parent directive will fire a broadcast event that the child directive is listening for. Mainly I can't get the broadcast listener to capture the broadcasted event when it is fired. Here is my code so far: <div all-checkboxes-broadcast> <a href="" ng-click="checkAll()">Select All</a> <a href="" ng-click="clearAll()">Clear All</a> <div all-checkboxes-listeners> <input type="checkbox" /> <

How to initialize the value of an input[range] using AngularJS when value is over 100

ぐ巨炮叔叔 提交于 2019-12-25 00:46:14
问题 I try to initialize a slider using AngularJS, but the cursor show 100 when the value is over 100. Setting the value 150 in a range [50,150] fails with this code : <html ng-app="App"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <script> angular.module('App', ['App.controllers']); angular.module('App.controllers', []).controller('AppController', function($scope) { $scope.min = 50; $scope.max = 150; $scope.value = 150; }); </script> </head

Is it possible to 'transclude' while keeping the scope of the directive in Angular?

人走茶凉 提交于 2019-12-25 00:39:24
问题 Is possible to do the following in Angular? <div ng-controller="MainCtrl" ng-init="name='World'"> <test name="Matei">Hello {{name}}!</test> // I expect "Hello Matei" <test name="David">Hello {{name}}!</test> // I expect "Hello David" </div> My directive is simple but it's not working: app.directive('test', function() { return { restrict: 'E', scope: { name: '@' }, replace: true, transclude: true, template: '<div class="test" ng-transclude></div>' }; }); I also tried to use the transclude

why filter is not working in angular js?

折月煮酒 提交于 2019-12-24 21:16:22
问题 I am trying to filter my list using input field and date field on button click .When I filled this field "to station "DEL" and "from station" "PNQ" "flight_date" "10-01-2017" .it should should one result .current it show no result . here is my code https://plnkr.co/edit/k4FBxqufETslgYxm4zEx?p=preview $scope.searchClick =function(){ if($scope.fromStation!='' && $scope.toStation!='' && $scope.departDate !=''){ $scope.names = $scope.names.filter(function(item){ return item.to_station === $scope

AngularJs directive reports wrong height

笑着哭i 提交于 2019-12-24 20:45:50
问题 I have created the jsFiddle to describe my problem. http://jsfiddle.net/rzajac/MMud3/ The directive itself is here: var myApp = angular.module('myApp', []); myApp.directive('map', function(){ return { restrict: 'E', scope: {}, link: function(scope, elem, attrs) { elem .height(400) .width(600) .vectorMap({ map: 'usa_en', backgroundColor: null, color: '#ffffff', hoverColor: '#999999', selectedColor: '#666666', enableZoom: false, showTooltip: true }); document.getElementById('mapHeight').value =