Posts

Showing posts from November, 2017

Adding a Full Task [PlannerTask] to 365 planner

Today i created an angular app to interact with MS 365 Planner. I tried to add a task. The example @MS - create task works fine
{"planId":"xqQg5FS2LkCp935s-FIFm2QAFkHM","bucketId":"hsOf2dhOJkqyYYZEtdzDe2QAIUCR","title":"Update client list","assignments":{"fbab97d0-4932-4511-b675-204639209557":{"@odata.type":"#microsoft.graph.plannerAssignment","orderHint":" !"}},}
Adding a details object was great until i was trying to add some checklist items.
My app gave this error [400]:

message:"Schema validation has failed. Validation for field 'Title', on entity 'Task' has failed: A non-null value must be specified for this field."

Well, this is the end of the story, since after everything went well in the Graph Explorer my app still gave the same error, until i notices that the Content-Type was application/x-www-form-urlencoded.

The Fix is
.…

Angular Dual App

or more exact run separate root components.

you can just add multiple components to the bootstrap: [ decorator.

then you can run as many apps as you want.

bootstrap: [   AppComponent,   LoginComponent,   ContactComponent,   TableComponent, ]
<body>   <app-welcome></app-welcome>   <app-login></app-login>   <app-table></app-table>   <app-contact></app-contact> </body>
Services?

in Angular 4 Services has scope. if we create a service at the App.Module Scope, it will share all it's info will all apps, all comps, but if you create a service, and declare it inside a providers:[ decorator, inside a specific Component, then all child components will share the same instance, but siblings comps declaring the same service will have their own instance.

MatDatePicker Errors

if you get this one

Can't bind to 'matDatepicker' since it isn't a known property of 'input'

then you're missing some modules in your import, the datepicker has many dependencies, and i didn't tried to find them, so just fill in the long long list in the plnk.

for this one

MatDatepickerToggle.html:1 ERROR TypeError: Cannot read property 'disabled' of undefined

you have some miss-spell like [for]="pickerFrom"vs#pickerFrom

Javascript sort then by

i'll just give a piece of code to show this Great Answer.

var a = [];
for (x = 1; x <= 3; x++){
for (y = 1; y <= 3; y++){
for (z = 1; z <= 3; z++){
a.push({x:x, y:y, z:z})
}
}
}
a


a.sort(function (a, b) {
    return a.z - b.z || a.x - b.x || a.y - b.y ;
});

just copy paste into the console and see for yourself.

for strings you'll need extra help

var a = [];
for (x = 1; x <= 3; x++){
for (y = 1; y <= 3; y++){
for (z = 1; z <= 3; z++){
a.push({x:x, y:y, z:'af' + z.toString()})
}
}
}

var strSort = function(a,b){
if(a < b) return -1;
    if(a > b) return 1;
    return 0;
}

a.sort(function (a, b) {
return strSort(a.z,b.z) || a.x - b.x || a.y - b.y ;
});