Search Posts

Category: symfony

AngularJS Symfony 2.8 Redirection to success page after registration

I have a registration form build with angularJs. The form URL is : http://localhost:8000/en/register/Both When form is valide this code is executed : else { $scope.disableSubmit = true; if (angular.isDefined($scope.user.countryChoise)) { $scope.user.country = $scope.user.countryChoise.id; } $scope.user.locale = $localStorage.language; $scope.current_type = $stateParams.type; $registerDataFactory.register($scope.user).$promise.then(function(data){ if(data.status == true){ $scope.registerSuccess = true; }else{ toaster.pop(‘error’, $filter(‘translate’)(‘title.error.SUBSCRIBTION’), data.message); $scope.disableSubmit = false; return false; } }); } The message confirmation is in the same template register.html : <div class=”mt-3 mb-3″ ng-if=”registerSuccess”> <h3 […]

symfony webpack encore angularJS

I made a migration from Symfony3.4 to SF4/Flex. I was using assetic/bundle in SF3.4 but now I try to replace it with symfony/webpack-encore. when I started using everything was okay but in my page I can’t display the values returned in my webservice. In my topTripsController a used a webservice to get a list of objects then I try to render them <div ng-controller=”topTripsController as homeNotLogged”> <div data-ng-repeat=”trip in homeNotLogged.trips track by $index” > <a […]

AngularJs download csv using Symfony2 StreamedResponce

I try to download a csv file, when I click the button on my page, like this: <span ng-click=”downloadCsv()” class=”table-settings__control”> <ng-include src=”‘app/icons/icon.html'” class=”table-settings__control-icon”> </ng-include> {{“table.menu.export” | translate}} </span> My controller method in AngularJs: vm.downloadHref = env.api + ‘page/export’; function downloadLmTreeCsv() { myService.downloadCsv(vm.downloadHref, $filter(‘date’)(vm.startDate, ‘dd-mm-yyyy H:i:s’)); } My Service in AngularJs: function downloadCsv(httpPath,date) { var fileName = generateCsvFileName(date); $http.get(httpPath,{ responseType: ‘arraybuffer’ }).success(function (data, status, headers) { var textCsv = ‘text/scv’; headers = headers(); var filename = […]

Download a CSV file in Javascript (or Symfony) from a Base64

I’m using a method to download a CSV file from a Base64. var dlnk = document.getElementById(“myDownloadButton”); dlnk.href = ‘data:application/octet-stream;base64,’ + myBase64; dlnk.click(); It worked until I realized that when the base64 is too long, I have a problem. It will open a white page and it won’t download my CSV file. I think it’s because my base64 is too long. Do you have an alternative in JavaScript or in Symfony 3? Thank you Source: AngularJS

Nothing adding in list display and database symfony/angular js

When I add my form (angularjs) nothing in list display and database MySQL I don’t know what’s wrong.Is someone know the problem? User.controller(symfony) namespace AppBundleControllerApi; use AppBundleEntityUser; use SymfonyBundleFrameworkBundleControllerController; use SensioBundleFrameworkExtraBundleConfigurationMethod; use SensioBundleFrameworkExtraBundleConfigurationRoute; use SymfonyComponentHttpFoundationRequest; use SymfonyComponentHttpFoundationResponse; use AppBundleServiceValidate; use SymfonyComponentHttpFoundationJsonResponse; use NelmioApiDocBundleAnnotationApiDoc; class UserController extends Controller { /** * @ApiDoc( * resource=true, * description=”Get the list users”, * section=”users” * ) * * @Route(“/api/users”,name=”list_users”) * @Method({“GET”}) */ public function listUser() { $users=$this->getDoctrine()->getRepository(‘AppBundle:User’)->findAll(); if (!count($users)){ […]

Angular and symfony in one dir – htaccess

I have following problem, I have in folder /var/www/html 2 dirs: app (angular application) and api(restful api and cms written in symfony3). In both directories there is appropriate htaccess for each application. The document root is /var/www/html and I need the website to be redirected to app/index.html, and only /api/ to api subfolder. But I can’t get this working with symfony htaccess. Angular htaccess is default provided. Symfony htaccess: DirectoryIndex app.php <IfModule mod_rewrite.c> RewriteEngine On […]

RESTFUL App in symfony 3

I am still quite confused about REST API, Angular and so on. I would like to build simple web app which allows users to book events and I would like to do it in Symfony 3 + Angular. In future, I could make it work on mobile phones as well. The reason I want to do it is to learn symphony 3, REST API and Angular better and to increase chance I will get hired. […]