angularjs-directive

What is wrong in angularjs controller

风格不统一 提交于 2019-12-13 00:03:33
问题 I have to add list as a category this is not working properly. I added PlaylistsCtrl.js, playlists.html file and my php json file below this question. PlaylistsCtrl.js .controller('PlaylistsCtrl', function($scope,$http) { var vm = this; vm.playlists = {}; $http.get("http://localhost/youtubewebservice/shop-categorylist-product.php") .success(function(response) { vm.playlists = response.records; }); }) playlists.html <ion-view view-title="playlists"> <ion-content> <ion-list> <ion-item ng-repeat

Angular Material datepicker filter specific date

梦想的初衷 提交于 2019-12-12 23:16:38
问题 Can someone please explain how to apply a custom date as a filter using Angular Material without causing everyweek on that day to be selectable? I've followed the documentation and can get it to work for the specific day of that week, yet it causes every week of the same day to be filtered. All the documentation appears to highlight this as a necessary feature for allowing/not allowing a user to select a specific date using the datepicker. 回答1: Please see below code. Basically, all I did was

how to generate form dynamically in angular js?

≡放荡痞女 提交于 2019-12-12 22:12:20
问题 I am using this https://github.com/Textalk/angular-schema-form plugin to generate my form will not display .I study all documentation and add all js required i didn't get any error but it not display why ? http://plnkr.co/edit/FO5iEs6ulmP3aR0PW4nt?p=preview <!DOCTYPE html> <html > <head> <link data-require="bootstrap-css@3.x" data-semver="3.2.0" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" /> <script data-require="angular.js@*" data-semver="1.3.0

AngularJS ng-repeat applied multiple times in $compiled directive

邮差的信 提交于 2019-12-12 21:27:09
问题 I've written a directive that dynamically creates a popover for an element: app.directive('popover', function($compile, $timeout){ return { link: function(scope, element, attrs) { $timeout(function() { // grab template var tpl = $(element).find('.popover-template') // grab popover parts of template var template = { //$compile( $(element).siblings(".pop-content").contents() )(scope) title: tpl.find('.template-title').contents(), content: tpl.find('.template-content').contents() }; // render

angularjs: dynamic html dependent on json data

送分小仙女□ 提交于 2019-12-12 21:22:04
问题 I want to show the content of my json model in a dynamic way, depending on the provided json. I use ng-repeat to loop through my data and want to display a html template to fill with data dependent on the encountered data type. JSON { "elements": [ { "type": "input-text", "desc": "Full Name" }, { "type": "input-checkbox", "desc": "Accept Terms" } ] } This should result in different html code, appropriate filled with the json content. E.g. <div><label>Full Name</label> <input type="text"></div

Angularjs - ng-model undefined

陌路散爱 提交于 2019-12-12 19:27:07
问题 I am building a rather complex directive in which I need access to ng-model on a specific element in the template which is enclosed into ng-if directive... I have a plunker and the explanation on how to see the issue is below. In the .compile function of the directive I have a line of code that looks like this ngModel = elm.find('textarea').controller('ngModel'); console.log(ngModel); In my template, I have a something like this: <div ng-if="views.view"> <textarea ng-model="exp.val"><

AngularJS : Creating a directive that repeats a transcluded template

徘徊边缘 提交于 2019-12-12 19:17:15
问题 I have a situation where I want to create a directive that takes an array of items and splits them into a variable number of columns, wrapping them with elements that make the columns. After spending hours upon hours of trying various things I am stumped as how to architect this. Here is how I want to use this directive: <columnize columnCount="3" collection="items"> <div>{{item.Name}}</div> <!-- this is the repeated part --> </columnize> The directive will receive two inputs, columnCount and

How to use compile function in AngularJS directive to ng-repeat elements from a service

孤街醉人 提交于 2019-12-12 18:23:30
问题 Could someone, please, show me what I need to do to render in a directive new elements stored in an array in a service. In the example below, an alert from the service shows that each new element is added to the elements array, but how to make the directive show these new elements on the page? I tried to read everything about compile function in a directive, but could not understand how to make my example work. Here is a jsfiddle. All I need is to render new messages inside the directive

Dynamically added directives not responding

心不动则不痛 提交于 2019-12-12 18:22:59
问题 I am building an app which loads some data from server and according to this data includes (appends) directives into the dom. Here is the main page html: <div ng-repeat="type in bet.bet_types"> <div ng-include src="getBetTypeById(type.id)"></div> </div> Here is the getBetTypeById(id) function from the scope: $scope.getBetTypeById = function(id) { switch(id) { case 1: return '/views/partials/1.html'; break; ... Here is the 1.html: <test-test bettype={{type}}></test-test> here is the tets-test

Adding a new element into the DOM with angularjs does not initiate it

安稳与你 提交于 2019-12-12 18:22:13
问题 Explaining further, I am using angular-summernote and I am using a directive to insert new WYSIWYG editor instances inside of the DOM. However, when I insert it into the DOM, the new editor does not load maybe because the init has already been fired. Here is the directive I am using, as well as a jsFiddle that works, it does insert the editor tags but it does not generate/start another editor: JSFiddle angular.module('summernoteDemo', ['summernote']) .directive('addSummernote', function () {