angularjs-scope

How to trigger a controller function after an Animation in Angular JS

限于喜欢 提交于 2019-12-13 04:39:32
问题 I have come to a standstill in terms on threading together a sequence of Animations and then a controller action. What I basically want to do is basically 1. click on a button/div, 2.Trigger an Animation, 3. Once animation is complete run a function in a controller that resets the button/div I have completed steps 1 & 2 and just need to get the last bit done. Here is the Button <button ng-class="{'clicked':clicked, 'correct' : answer.answer == 'correct' }" ng-click="clicked = true" ng-repeat=

Angularjs custom directive child scope access parent scope method?

元气小坏坏 提交于 2019-12-13 04:30:33
问题 I am trying to create a carousel with AngularJS ans UI Bootstrap. Since the carousel in UI bootstrap only supports images, I wan to write my own directive to support youtube video. I want the video to start to play when the video slide is active, and pause when the slide is not active. Also I would like to pause the carousel lopping when the video is playing. So far i have done the first part but can't pause the carousel because i can't access the pause method of the carousel scope. My code:

AngularJS - Converting Incorrect Use of Service To Directive

微笑、不失礼 提交于 2019-12-13 04:23:35
问题 I have a table with a fixed width; if the data within the table exceeds the defined width, the user that the ability to scroll left and right as i have a CSS element of overflow: auto; . What i am trying to do is introduce buttons on either side of the table, so that the user can click on them, and the table will scroll to the left or right. I have achieved this using an Angular service, but on ng-click, the table only scrolls left or right once. I have a feeling this is because i have used a

AngularJS style issue IE

孤街醉人 提交于 2019-12-13 04:16:34
问题 Im trying to figure out how to make this work on IE: <div ng-if="result.is_mesurable==true" style="left:{{ (result.user_score * 20)-10}}%" class="test-box"> The code basically generates a dynamic table, and the left position of the object is taken from the user_score value. I know that IE doesn't read this declaration properly, i had a similar bug in the past: AngularJS weird render issue "Because {{xxx.xxx}} is invalid css it is trucated by IE and when the angular compiler scans all

AngularJS - Unit test for http get to JSON file

纵饮孤独 提交于 2019-12-13 04:13:07
问题 I am trying to write a unit test to test a simple factory that performs a http.get to retrieve a JSON file. The factory is called within my controller. Here's a plunker showing my http.get: http://plnkr.co/edit/xg9T5H1Kreo4lwxzRQem?p=preview Ctrl: app.controller('MainCtrl', function($scope, $http, factoryGetJSONFile) { factoryGetJSONFile.getMyData(function(data) { $scope.Addresses = data.Addresses.AddressList; $scope.People = data.Names.People; }); }); Factory: app.factory('factoryGetJSONFile

Watch form validity from controller

六月ゝ 毕业季﹏ 提交于 2019-12-13 02:26:03
问题 I have a form within my controller. I'd like to be able to set a scope variable based on the validity of this form. I've given the form a name already: <div ng-controller="myCtrl"> ... <form name='myForm'> ... </form> ... </div> And have created a $watch on that form's $valid property (this is located in the controller which contains this form): $scope.$watch('myForm.$valid', function(oldVal, newVal) { console.log("Woo! This might be working!"); if (newVal) { $scope.otherVar = true; } else {

AngularJS - Can't access retrieved JSON data in the view

烈酒焚心 提交于 2019-12-13 02:16:04
问题 I just spent the last hour searching and reading a bunch of similar stackoverflow pages and was unable to find a solution. I'll try to be as descriptive as possible, but please let me know if I need to provide any other details. Basically, I'm trying to grab a .json file using $http GET. Once I get it, I'll store it in $scope.bags and then on my html (view) page, I am trying to access the contents to use such as title, details, images, etc. Lets start with the controller: munyApp.controller(

TypeError: Cannot read property 'go' of undefined

寵の児 提交于 2019-12-13 02:13:06
问题 //controller pour connection to API .controller('LoginConnect', ['$scope','connecting','sendtoken','$state', function($scope,connecting,sendtoken,$state){ var token = []; $scope.user = {}; var users = $scope.user; var cgtpage = false; $scope.connect = function (users,token,$state) { var log = $scope.user.login; var pass = $scope.user.password; var mydata = {}; connecting.login(log,pass).then(function(result){ var montoken = result.data.token; sessionStorage.setItem('token',montoken); console

Modified data in a factory that's bound to a controller's scope, it doesn't update

百般思念 提交于 2019-12-13 01:13:33
问题 I have a pretty simple example (also available on this fiddle: http://jsfiddle.net/depov5w6/) I have 2 factories, one which returns an object with the property 'data', (which is bound to the scope of a controller) and another factory that has 2 methods: populateData and pushData. populateData sets the value of dataSource.data to be a new value. pushData pushes a new value onto dataSource.data angular.module("app",[]) .factory('dataSource', function() { return { data: ["Init Data"] }; })

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