Category : angular

i am sending boolean type date from angular frontend to laravel backend and i am using FormRequest for data validation. here is the data i send from angular: {‘full_name’ : searchTerm,’is_search_friend’:true} FormRequest ‘full_name’ => ‘required|string|min:1|max:50’, ‘is_search_friend’ => ‘required|boolean’ i get this error : is_search_friend: [" is search friend must be true or false"] meanwhile i ..

Read more

Working on a small ionic framework application with laravel backend. Request from postman or browser works fine, but builds from Android’s getting 419 token mismatch error with same endpoints. Request Data from Android (error 419): Headers Accept application/json Accept-Encoding gzip, deflate Accept-Language en-AU,en-US;q=0.9,en;q=0.8 Authorization [Filtered] Content-Length 25 Content-Type application/json Host app.example.com Origin http://localhost Referer http://localhost/ ..

Read more

Working on a small ionic framework application with laravel backend. Request from postman or browser works fine, but builds from Android’s getting 419 token mismatch error with same endpoints. Request Data from Android (error 419): Headers Accept application/json Accept-Encoding gzip, deflate Accept-Language en-AU,en-US;q=0.9,en;q=0.8 Authorization [Filtered] Content-Length 25 Content-Type application/json Host app.example.com Origin http://localhost Referer http://localhost/ ..

Read more

I’m working with Laravel and Angular. I want to display the authenticated user’s data. I’m getting datas from Laravel with JSON and I’m using this code for the user datas. const headers = new HttpHeaders({ Authorization: `Bearer ${localStorage.getItem(‘token’)}` }); this.http.get(‘http://127.0.0.1:8000/api/user’, {headers}).subscribe( result => (this.user = result, console.log(result)) ); It’s working but after a certain time ..

Read more

I have the following Angular code: <tr dir-paginate="item in file.messages | orderBy: orderByField: orderByReversed | itemsPerPage: 10: ‘fileMessages’" pagination-id="fileMessages"> <td>{{ item.id }}</td> <td>{{ item.created_at }}</td> <td><span data-ng-class="[‘label’, ‘label-‘ + item.type]">{{ item.type }}</span></td> <td>{{ item.message }}</td> </tr> Now the item.message contains some html which is coming from back end of the application which is in Laravel. ..

Read more

In a project I am using Angular-12 as frontend and Laravel-8 as backend. Laravel: $employee = Employee::find($id); $employee->nationality_id = $request->nationality_id; $employee->state_id = $request->state_id ?? ”; $employee->city_id = $request->city_id ?? ”; $employee->save(); Angular: component: loadCountryData(event: any) { // this.profileInfoForm.patchValue({ state_id: null }); if (event) { this.country_id = event.id; this.cstatesService.getStatesByCountry(this.country_id).subscribe( (data) => { this.cstates = data.results.states; this.state_id ..

Read more

I am using Angular-12 as frontend and Laravel-8 as backend (api) for profile: Laravel backend: public function rules() { return [ ‘first_name’ => [ ‘required’, ‘string’, ‘max:50’ ], ‘last_name’ => [ ‘required’, ‘string’, ‘max:50′ ], ’employee_photo’ => [ ‘nullable’, ‘max:2048’ ], } public function addProfile(StoreProfileRequest $request) { $employee = new Employee(); $employee->first_name = $request->first_name; $employee->last_name ..

Read more

i have ecommerce project and i need to view the images of the products and i don’t know how to get it with angular and i wish anyone can help me the store function in laravel public function store(Request $request) { $validator = Validator::make($request->all(), [ ‘name’ => ‘required|string|max:100’, ‘display’ => ‘required|string|max:100’, ‘ram’ => ‘required|string|max:100’, ‘img’ ..

Read more

iam working with angular and laravel APIs on ecommerce project, when i try to create a new product via the API from postman and i upload the image and the data of the product it success and working well, but when i try this with angular ReActiveForms it doesn’t work, i assume that i made ..

Read more

I’m trying to encrypt the request values using crypto.js from Angular and trying to decrypt in the backend from Laravel 8(php 7.4). But I’m not getting the expected output, getting different values when I decrypt the encrypted value. Codes are mentioned below. Frontend Angular code set() { var message = "52q6x93k4y"; var key = "6Le0DgMTAAAAANokdEEial" ..

Read more

I have a laravel and angular app when i run angular app i’m getting following error: Access to XMLHttpRequest at ‘http://localhost/project/public/api/register’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. I already have CORS middleware: <?php namespace ..

Read more